0

I am receiving a soap FAULT message through two way port and looks as below ,

<S:Fault xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
    <faultcode>S:Status</faultcode>
    <faultstring>Exception occured: TransactionRolledback</faultstring>
</S:Fault>

Error i am receiving : Only object types of 'System.Exception' can be added to the ESB Fault Message using this function

I am using separate exception block in orchestration using BTS.soap_envelope_1__1.Fault but still it fails ,

I want to catch this is ESB Exception and send to ESB Portal.

sukra
  • 123
  • 1
  • 10
  • What type of exception are you catching in your exception block? Fails in what way, doesn't catch it, or throws a different error? – Dijkgraaf Jan 12 '21 at 03:19
  • Only object types of 'System.Exception' can be added to the ESB Fault Message using this function. this is the error what i am getting in esb ! I think there is a schema mismatch ! @dijkgraaf – sukra Jan 12 '21 at 16:39
  • Please [Edit] your question to include that error, as well as the code in your expression shape in the exception block. Also you haven't answered what type of exception your exception block is catching. – Dijkgraaf Jan 12 '21 at 20:01

1 Answers1

-1

Follow the steps provided on this thread answer to catch the soap fault. Also as suggested adding steps here

To get the SOAP Fault into your orchestration:

  1. On the Send port in BizTalk: a) WCF Adapter Properties, Messages tab: Propagate Fault Message = true b) WCF Adapter Properties, Messages tab: Inbound message body: Either use "soap:Body" or use a path that extracts your message OR /*[local-name()='Fault'] to get the SOAP fault c) "Enable routing for failed messages" - this has no impact on the SOAP Fault. So you probably want it set to true to handle real transmission errors (non SOAP faults).

  2. On the Send port within your orchestration

  • Select the operation & then "New Fault Message"
  • Set the message name to SoapFault (or whatever)
  • Set the message type to be the referenced schema: BTS.soap_envelope_1__2.Fault. (If this was a SOAP 1.1 operation you would use BTS.soap_envelope_1__1.Fault).
  1. In the Scope around your Send operation
  • Add new exception handler
  • Select "Exception Object Type" to the port-name.operation-name.SoapFault you created in step 2
  • Specify the object name, e.g. Fault
  • Fault is now the XML of the SOAP Fault & you can use XPath to get the Fault Reason and Message elements.

Now, if a SOAP Fault occurs, no "exception" is shown in the BizTalk tracked message events view - it just shows that your orchestration receives the SOAP fault message. But inside your orchestration the message is treated as an exception and your "SoapFault" exception handler is called. You get a "FaultReceiveException".

Notes 1) The BizTalk Send Port tranmission retries option does not take effect if a SOAP fault occurs, because this is no longer viewed as a transmission failure. This is unfortunate, since the SOAP fault might be occuring due to a temporary problem at the target service & on retry the request might work.

2) Because the SOAP fault is not viewed by BizTalk as an error, your orchestration needs to log the message if you want to use routing of failed messages

3) You still need an exception handler for XlangSoapException's (i.e. System.Web.Services.Protocols.SoapException) and/or general exceptions, since these still occur for transmission errors (target server down, etc)

  1. Because of (3), you will probably still want to specify "Enable routing for failed messages" to prevent suspended messages from occuring.

  2. In my example I just received the soap:Fault part of the message, but you can pick up the entire soap:Envelope if needed.

Vikas Bhardwaj
  • 1,455
  • 8
  • 10