Pete Freitag Pete Freitag

ColdFusion SOAP Web Services and onRequestStart

Published on November 19, 2009
By Pete Freitag

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(

coldfusion soap axis onrequeststart issoaprequest application web services

ColdFusion SOAP Web Services and onRequestStart was first published on November 19, 2009.

If you like reading about coldfusion, soap, axis, onrequeststart, issoaprequest, application, or web services then you might also like:


The Fixinator Code Security Scanner for ColdFusion & CFML is an easy to use security tool that every CF developer can use. It can also easily integrate into CI for automatic scanning on every commit.

Try Fixinator

The weekly newsletter for the CFML Community


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