SOAP Web Service Errors Are Handled Externally To The ColdFusion Application Framework

<cfcomponent
	output="false"
	hint="I provide application settings and event handlers.">
 
	<cfsetting showdebugoutput="false" />
 
	<cffunction
		name="OnError"
		access="public"
		returntype="void"
		output="true"
		hint="I handle uncaught application errors.">
 
		<!--- Define the arguments. --->
		<cfargument
			name="Exception"
			type="any"
			required="true"
			hint="I am the uncaught exception."
			/>
 
		<!--- Define the local scope. --->
		<cfset var LOCAL = {} />
 
 
		<cfxml variable="LOCAL.SOAPResponse">
 
			<SOAP-ENV:Envelope
				xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
 
				<SOAP-ENV:Body>
 
					<SOAP-ENV:Fault>
						<faultcode>ErrorCode</faultcode>
						<faultstring>ErrorString</faultstring>
						<detail />
					</SOAP-ENV:Fault>
 
				</SOAP-ENV:Body>
 
			</SOAP-ENV:Envelope>
 
		</cfxml>
 
 
		<!--- Set error response code. --->
		<cfheader statuscode="500" statustext="Server Error" />
 
		<!--- Stream soap error. --->
		<cfcontent
			type="text/xml"
			variable="#ToBinary( ToBase64( LOCAL.SOAPResponse ) )#"
			/>
 
		<!--- Return out. --->
		<cfreturn />
	</cffunction>
 
</cfcomponent>

For Cut-and-Paste