Here in this example, I have created a separate BizTalk application to handle the all port level exception.
You need to develop following items for this activity:
- Schema for Error Details– You need to create schema to specify the error description, failure type etc. and other info as per business requirement. As we know that there are 15 types of exception details available.
<Details>There was a failure executing the receive pipeline: “Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31bf3856ad364e35” Source: “XML disassembler” Receive Port: “RPFaultTest” URI: “D:\Research\FaultMessage\FaultTestInput\*.xml” Reason: Finding the document specification by message type “MessageTest” failed. Verify the schema deployed properly. </Details>
<ErrorMessage>There was a failure executing the receive pipeline</ErrorMessage>
- Orchestration: to specify exception details, create error message and send original message to alternative transaction
- Send Port: to transaction for error message
- Send Port: to transaction of original message (it’s optional)
We need to create orchestration same like as below if you are not adding more business complexity.
Firstly, in Orchestration we need to create two messages, one for receiving original message and 2nd for error message.
1st message type should be System.Xml.XmlDocument type. It would not have defined any specified message schema for incoming message because BizTalk already remove all the specified promoted property and append Exception properties.
So original message will always defined in System.Xml.XmlDocument object type.
At receive location of orchestration, receive port should be Direct type.
Apply appropriate filter at receive shape. Mostly we define below types of filter at receive shape.
Above filter can receive all application’s exception. If we need to defined more specific then apply more filter options as port name as below:
After Receive Shape Configuration, you need to work on error message. below is a sample how to get exception details are create an Error Message.
You can get Exception details into xml format or you can generate event log for the same, it’s up to Business requirement.
Create Send Port to send Error message and Original message.
Note: Remember that you need to check the check box of Enable routing for failed Messages on Send Port as well as Receive Port.