Yesterday, when I was experimenting with SOAP request error handling inside of the ColdFusion application framework, I came across what I think is a ColdFusion bug. It seems that if you call ColdFusion's GetHTTPRequestData() method during a SOAP request, the method executes properly, returning the HTTP request data, but it breaks the SOAP response, throwing the following error:
org.xml.sax.SAXParseException: Premature end of file.
To see this in action, check out this video:
In the video, I am using CFDump to output the GetHTTPRequestData() to an external file:
<cfcomponent output="false" hint="I provide application settings and event handlers."> <cfsetting showdebugoutput="false" /> <cftry> <cfdump var="#GetHTTPRequestData()#" format="html" output="#ExpandPath( './soaprequest.htm' )#" /> <cfcatch> <cfdump var="#CFCATCH#" format="html" output="#ExpandPath( './soaprequest.htm' )#" /> </cfcatch> </cftry> </cfcomponent>
... however, the same error occurs even I simply call GetHTTPRequestData() and store the result into the Application.cfc public scope:
<cfset this.test = GetHTTPRequestData() />
So, it's clearly not a problem with CFDump, but rather with the invocation of the GetHTTPRequestData() method itself. Unless I am missing something obvious here, this appears to be a bug in the way that GetHTTPRequestData() interacts with SOAP-based requests. Any thoughts?
Want to use code from this post? Check out the license.