Error mapping field faultcode in SOAP Fault in Tibco BusinessWorks
Facts - Tibco
Tuesday, 20 December 2011 20:23

This note has been tested with Tibco BusinessWorks 5.8 and Tibco Designer 5.6

In BusinessWorks a Soap Fault was received in the reply of a Soap Request/Reply activity:

<S:Fault xmlns:S = "http://schemas.xmlsoap.org/soap/envelope/">
  <faultcode>S:Server</faultcode>
  <faultstring>Invalid Content-Type=Empty</faultstring>
</S:Fault>

This error was caught using a Catch activity and re-thrown using the Generate Error activity. In the input tab of the Generate Error activity the element faultcode was mapped to a string. This resulted in the following error in BusinessWorks:

<ns0:ErrorReport xmlns:ns0 = "http://www.tibco.com/pe/EngineTypes">
  <StackTrace>Job-79000 Error in [Tests/SOAPRequestReply.process/Generate Error From Fault]
Unable to cast xs:QName('{http://schemas.xmlsoap.org/soap/envelope/}Server') to xdt:untypedAtomic. 
Cause: no prefix defined for namespace "http://schemas.xmlsoap.org/soap/envelope/"
java.lang.Exception: no prefix defined for namespace "http://schemas.xmlsoap.org/soap/envelope/"
            at com.tibco.xml.data.primitive.ExpandedName.a(ExpandedName.java:355)
            at com.tibco.xml.data.primitive.ExpandedName.getLegacySerializedForm(ExpandedName.java:270)
.............
  </StackTrace>
  ..........
</ns0:ErrorReport>

What happened: the faultcode element is of xsd type QName. BusinessWorks does not convert this type to a string automatically. After explicitly converting this field to a string, using the XPath string() function, the element faultcode could be mapped inside the Generate Error activity without generating the extra error.