GetHTTPRequestData() Breaks The SOAP Request / Response Cycle In ColdFusion

Posted June 5, 2009 at 8:38 AM

Tags: ColdFusion

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:

Application.cfc

 Launch code in new window » Download code as text 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:

 Launch code in new window » Download code as text file »

  • <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?

Download Code Snippet ZIP File

Post Comment  |  Ask Ben  |  Other Searches  |  Print Page





Reader Comments

Jun 5, 2009 at 8:54 AM // reply »
29 Comments

Yep, I ran into this issue when using CF to secure a webservice via Basic Auth: http://www.mischefamily.com/nathan/index.cfm/2008/8/13/Basic-Authentication-With-ColdFusion

I can't remember if I reported it as bug or not.


Jun 5, 2009 at 9:00 AM // reply »
7,463 Comments

@Nathan,

No problem, I just submitted it as a bug.


Jul 8, 2009 at 9:56 AM // reply »
2 Comments

Ben, did you get any fix for this. i am having the same issue. i do have a soap webservice which is not serving any wsdl, i am trying to access that but i am getting the the same error you are getting. can you post the complete code including soap header etc...thanks.


Jul 8, 2009 at 10:00 AM // reply »
7,463 Comments

@Manju,

There is no fix for this at the moment, other than to not use GetHTTPRequestData() in conjunction with SOAP web services calls, as far as I know. Perhaps Adobe will fix this bug in later releases.


Jul 8, 2009 at 10:08 AM // reply »
2 Comments

i have couple questions.
i have a webserver i need to access invoke some soap web servies. but there is no wsdl served by the server( it is a third party server built in some C# or so). but i have a wsdl the company sent me can i save that on to my server and point that to web service hosting server and use that. is that possible....some one on the web said it is possible. i never did anything like that. untill now what ever i use had WSDL so i used direct cfinvoke...that's it. now i am trying to use soap route...

if i can not use the above method (saving wsld locally) or get HTTP then what other route i can go...let me know and post me some sample code.. thanks for your help


Post Comment  |  Ask Ben

Recent Blog Comments
Mar 10, 2010 at 1:35 PM
Project HUGE: Dig Deep Fitness iPhone App And Huge In A Hurry
I can't find the app in the iphone store. Where can I get it? P.S. Big fan of the blog, Ben! ... read »
Mar 10, 2010 at 12:33 PM
(CF)JSON - My Own ColdFusion Version For AJAX
Thanks, Ben! I was banging my head against this for a bit - you've saved me a flat spot on my forehead. ... read »
Mar 10, 2010 at 12:24 PM
How Do You Use The ColdFusion CFParam Tag?
@prims, You can use CFParam to param any type of variable in ColdFusion. ... read »
Mar 10, 2010 at 12:23 PM
How Do You Use The ColdFusion CFParam Tag?
Hi Ben, Can we use cfparam in session scope? Thanks ... read »
Mar 10, 2010 at 11:47 AM
Using Base64 Canvas Data In jQuery To Create ColdFusion Images
This is awesome. Is there a way to implement this on any other touchscreen device, Example BB Storm? ... read »
Mar 10, 2010 at 11:09 AM
Dynamic ColdFusion Variables Via Quoted Naming
@Jim, Awesome. ... read »
Mar 10, 2010 at 11:04 AM
Using Base64 Canvas Data In jQuery To Create ColdFusion Images
@Ryan, I have not seen that - thanks for posting it here. I'll be sure to check it out. ... read »
Mar 10, 2010 at 11:01 AM
Dynamic ColdFusion Variables Via Quoted Naming
Thanks Ben, that's sorted my problem out. Many thanks Jim ... read »