ColdFusion SOAP Web Services and onRequestStart

coldfusion

I knew there are some issues with using onRequest in your Application.cfc and web services, but I didn't think there were any issues with onRequestStart and ColdFusion 8 SOAP web services.

Today while working on one of my clients web services I started getting the error org.xml.sax.SAXParseException: Premature end of file. on any web service call. The web service worked fine a few days ago.

The problem was that another developer added the following to the existing onRequestStart:

<cfset var headers = GetHttpRequestData().Headers>

Apparently will cause bad things to happen. As a workaround I thought this would be a great use for the function IsSOAPRequest() added to CF7, I've never used it.

Well it turns out that IsSOAPRequest() always returns false in onRequestStart! (On ColdFusion 8, I haven't tested this on 9)

I ended up using arguments.targetPage to condition calling GetHttpRequestData() and all was well.

Here's the full stack trace I was getting:

org.xml.sax.SAXParseException: Premature end of file.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at org.apache.axis.server.AxisServer.initSOAPConstants(AxisServer.java:345)
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:279)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
	at coldfusion.xml.rpc.CFCServlet.doAxisPost(CFCServlet.java:270)
	at coldfusion.filter.AxisFilter.invoke(AxisFilter.java:43)
	at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:273)
	at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
	at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
	at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
	at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
	at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
	at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
	at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
	at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138)
	at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
	at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
	at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
	at jrun.servlet.FilterChain.service(FilterChain.java:101)
	at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
	at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
	at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286)
	at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
	at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
	at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
	at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
	at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


Related Entries

1 person found this page useful, what do you think?

 Download FuseGuard WAF for ColdFusion

Trackbacks

Trackback Address: 733/8C7A5E80410B51066A3388A7B1A09DDA

Comments

On 11/20/2009 at 5:11:16 PM EST Ben Nadel wrote:
1
The documentation for isSOAPRequest() is very odd; maybe because it is unclear, or maybe because I just never used the method. From what I could gather, it looks like isSOAPRequest() is intended to only work from *within* the CFC being invoked.

In the docs, under usage, it says:

"Call this function within a CFC to determine if it is running as a web service."

So, I think it might not work unless it is being called from within the target CFC. Odd method if that is the case.

On 11/20/2009 at 5:45:04 PM EST Pete Freitag wrote:
2
Ben, thanks, that makes sense, but it would be nice if it also worked in Application.cfc for uses I pointed out in the entry.

On 11/20/2009 at 5:46:17 PM EST Ben Nadel wrote:
3
Yeah, completely agree. In fact, having it inside the target CFC seems kind of useless :)

On 04/29/2010 at 6:10:04 PM EDT Raymond Camden wrote:
4
Lost half a damn day to this. I couldn't find a report of this in the public bug tracker, so I filed a new report. Thanks Pete.

On 06/24/2014 at 8:00:29 PM EDT Infinity Downline wrote:
5
ColdFusion SOAP Web Services and onRequestStart Infinity Downline http://InfinityDownline.com/?id=ianhardy007

Post a Comment




  



Spell Checker by Foundeo

Recent Entries



foundeo


did you hack my cf?