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  |  Permalink  |  Other Searches  |  Print Page




Learning ColdFusion 9 - ColdFusion 9 tutorials, samples, examples, demos

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 »
6,371 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 »
6,371 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
Jill
Nov 7, 2009 at 11:40 AM
How To Unformat Your Code (Like A Pro)
Derek, I think you might be right - sweet! Thanks for the link :) ... read »
Nov 7, 2009 at 11:25 AM
How To Unformat Your Code (Like A Pro)
I think it would be way easier to just use this http://www.logichammer.com/html-formatter/ He just released v3 and it rocks. ... read »
Jill
Nov 7, 2009 at 7:58 AM
How To Unformat Your Code (Like A Pro)
LMAO - this was pretty funny! I have to admit - I also love to reformat code so I can read it. My boss used to tell me to leave my OCD at home. Now I don't feel so bad after reading everyone else' ... read »
Nov 6, 2009 at 10:10 PM
How To Unformat Your Code (Like A Pro)
The timing of this post is just uncanny. I spent the last 15-20 minutes manually un-formatting my "Ben Nadel" style code within a CFC of mine. I was really digging the readability a few weeks ago, bu ... read »
Roe
Nov 6, 2009 at 5:11 PM
Passing Arrays By Reference In ColdFusion - SWEEET!
ArraySort also reorders the results of these java obj's ... read »
Nov 6, 2009 at 4:53 PM
How To Unformat Your Code (Like A Pro)
I tried to go *back* the other way. Adding formatting is actually a much more complicated problem than removing formatting. Anyway, here is what I could put together with a minimal amount of time: ... read »
Asaf
Nov 6, 2009 at 2:35 PM
ColdFusion GetPageContext() Massive Exploration
Hi, I actually found this post useful. I recently acquired a SSL certificate for my website and when I switched over to HTTPS Internet Explorer would throw an error when trying to download a dynamic ... read »
Nov 6, 2009 at 2:19 PM
How To Unformat Your Code (Like A Pro)
@Chuck, @Nathan, Well, now I feel like it's a challenge.... I accept. ... read »