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

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)

Hi

 

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

Steps:

  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()='http://www.w3.org/2003/05/soap-envelope']/*[local-name()='Code' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/*[local-name()='Value' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/text()");
strSoapFaultReason = xpath(msgSoapFault, "/*[local-name()='Fault' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/*[local-name()='Reason' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/*[local-name()='Text' and namespace-uri()='http://www.w3.org/2003/05/soap-envelope']/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="http://www.w3.org/2003/05/soap-envelope">
  <soap:Code>
    <soap:Value>soap:Sender</soap:Value>
    <soap:Subcode>
      <soap:Value>IllegalString</soap:Value>
    </soap:Subcode>
  </soap:Code>
  <soap:Reason>
    <soap:Text xml:lang="en">Random text</soap:Text>
  </soap:Reason>
</soap:Fault>

 

Notes: The whole process is an exact replica of post http://masteringbiztalkserver.wordpress.com/2010/11/21/catching-soap-faults-from-wcf-service-in-biztalk-orchestration/.

 

I appreciate any form of help.

Kind regards

A.H.

Edit
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
    Edit
Page 1 of 1 (2 items)