ColdFusion SOAP Web Services and onRequestStart


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(
	at org.apache.axis.encoding.DeserializationContext.parse(
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(
	at org.apache.axis.Message.getSOAPEnvelope(
	at org.apache.axis.server.AxisServer.initSOAPConstants(
	at org.apache.axis.server.AxisServer.invoke(
	at org.apache.axis.transport.http.AxisServlet.doPost(
	at coldfusion.xml.rpc.CFCServlet.doAxisPost(
	at coldfusion.filter.AxisFilter.invoke(
	at coldfusion.filter.ApplicationFilter.invoke(
	at coldfusion.filter.RequestMonitorFilter.invoke(
	at coldfusion.filter.MonitoringFilter.invoke(
	at coldfusion.filter.PathFilter.invoke(
	at coldfusion.filter.LicenseFilter.invoke(
	at coldfusion.filter.ExceptionFilter.invoke(
	at coldfusion.filter.ClientScopePersistenceFilter.invoke(
	at coldfusion.filter.GlobalsFilter.invoke(
	at coldfusion.filter.DatasourceFilter.invoke(
	at coldfusion.xml.rpc.CFCServlet.invoke(
	at coldfusion.xml.rpc.CFCServlet.doPost(
	at javax.servlet.http.HttpServlet.service(
	at org.apache.axis.transport.http.AxisServletBase.service(
	at javax.servlet.http.HttpServlet.service(
	at coldfusion.bootstrap.BootstrapServlet.service(
	at jrun.servlet.FilterChain.doFilter(
	at coldfusion.monitor.event.MonitoringServletFilter.doFilter(
	at coldfusion.bootstrap.BootstrapFilter.doFilter(
	at jrun.servlet.FilterChain.doFilter(
	at jrun.servlet.FilterChain.service(
	at jrun.servlet.ServletInvoker.invoke(
	at jrun.servlet.JRunInvokerChain.invokeNext(
	at jrun.servlet.JRunRequestDispatcher.invoke(
	at jrun.servlet.ServletEngineService.dispatch(
	at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(
	at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(
	at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(
	at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(

Related Entries

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

 Download FuseGuard WAF for ColdFusion


Trackback Address: 733/8C7A5E80410B51066A3388A7B1A09DDA


On 11/20/2009 at 3:11:16 PM UTC Ben Nadel wrote:
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 3:45:04 PM UTC Pete Freitag wrote:
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 3:46:17 PM UTC Ben Nadel wrote:
Yeah, completely agree. In fact, having it inside the target CFC seems kind of useless :)

On 04/29/2010 at 4:10:04 PM UTC Raymond Camden wrote:
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 6:00:29 PM UTC Infinity Downline wrote:
ColdFusion SOAP Web Services and onRequestStart Infinity Downline

Post a Comment


Spell Checker by Foundeo

Recent Entries


did you hack my cf?