English

Problem: ColdFusion MX does not support explicit SOAP exceptions

Description

In ColdFusion MX, SOAP error messages can be difficult to decipher because the actual exception error is surrounded by irrelevant information.

Cause

ColdFusion MX does not handle explicit SOAP exceptions.

Solution or Workaround

Use the following code in the CFM files. This code removes unwanted error messages and displays only the explicit SOAP exception in the Web browser. This code is written for Cold Fusion MX 7.1, but also works with other versions.

Code:
<cftry>

<!--- Invoke webservice code here..... --->

<cfcatch type = "any">
<cfset errMessage = #cfcatch.detail#>

<cfoutput>
<cfset soapErrStart = #findnocase("faultString",errMessage)# >
<cfset soapErrEnd = #find("faultActor",errMessage,soapErrStart)# >
<cfif soapErrStart gt 0 >
<br><font color=red> * #mid(errMessage,soapErrStart,(soapErrEnd-soapErrStart))# </font><br><br>
<cfelse>
<br><font color=red> * #errMessage# </font><br><br>
</cfif>
</cfoutput>

</cfcatch>
<cftry>