Integrating Integrators – BizTalk, Windows Azure, Windows Workflow, and Beyond

Re: Extracting SOAPFault Code and Reason in orchestration

BizTalk 2010

This group is for all content related to BizTalk Server 2010. This includes a forum and samples.

Extracting SOAPFault Code and Reason in orchestration

Answered (Not Verified) This question has suggested answer(s)



I'm having trouble extracting SOAPFault Code and Reson values (string).


  1. I'm using a Scope and Catch-shape to catch BTS.soap_envelope_1__2.Fault (variable sf)
  2. When BTS.soap_envelope_1__2.Fault is cought (I see that it is, in the event viewer), since sf is a variable, I create a new message of type BTS.soap_envelope_1__2.Fault (also tried with message of type XmlDocument) and make it equal to sf (msgSoapFault = sf;). I also confirmed that msgSoapFault contains the same value as sf since I studied it in my debug output.
  3. I use following expression to extract Code and Reason from msgSoapFault:

strSoapFaultCode = xpath(msgSoapFault, "/*[local-name()='Fault' and namespace-uri()='']/*[local-name()='Code' and namespace-uri()='']/*[local-name()='Value' and namespace-uri()='']/text()");
strSoapFaultReason = xpath(msgSoapFault, "/*[local-name()='Fault' and namespace-uri()='']/*[local-name()='Reason' and namespace-uri()='']/*[local-name()='Text' and namespace-uri()='']/text()");


In my debug output I see that strSoapFaultCode and strSoapFaultReason are empty. The orchestration also throws NullReferenceException since I'm trying to compare strSoapFaultCode with a string: strSoapFaultCode.Contains("soap:Sender").


I know that my XPath is correct, I have tested it against the SOAPFault message manually. This is the SOAPFault that I catch in step 1:

<soap:Fault xmlns:soap="">
    <soap:Text xml:lang="en">Random text</soap:Text>


Notes: The whole process is an exact replica of post


I appreciate any form of help.

Kind regards


All Replies
  • I got help on MSDN BizTalk forum. The xpath must convert result to a string by using strng-function. E.g. xpath(msgSoapFault, "string(xpath)")

    Suggested by
Page 1 of 1 (2 items)