Handling Port level exception through orchestration

We can handle port level exception related info through orchestration. For this, we need to create a separate BizTalk application. Or We can create an orchestration in same project but it is better to have separate BizTalk application to handle all the exception throughout the applications deployed on BizTalk admin console. This decision is totally based on the business requirement.

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:

  1. 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.
    • ErrorReport.FailureCode
    • ErrorReport.FailureType
    • ErrorReport.FailureCategory
    • ErrorReport.FailureInstanceID
    • ErrorReport.FailureMessageID
    • ErrorReport.Failuretime
    • ErrorReport.Description
    • ErrorReport.MessageType
    • ErrorReport.ReceivePortName
    • ErrorReport.InboundTransportLocation
    • ErrorReport.SendPortName
    • ErrorReport.OutboundTransportLocation
    • ErrorReport.ErrorType
    • ErrorReport.RoutingFailureReportID
    • ErrorReport.ProcessingServer

 

Sample XML:

<ErrorDetails>

  <Details>There was a failure executing the receive pipeline: “Microsoft.BizTalk.DefaultPipelines.XMLReceive, Microsoft.BizTalk.DefaultPipelines, Version=3.0.1.0, 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>

  <Errors>

    <Error>

      <ErrorMessage>There was a failure executing the receive pipeline</ErrorMessage>

      <ErrorType>FailedMessage</ErrorType>

      <FailureCode>0xc0c01657</FailureCode>

    </Error>

  </Errors>

</ErrorDetails>

 

  1. Orchestration: to specify exception details, create error message and send original message to alternative transaction
  2. Send Port: to transaction for error message
  3. Send Port: to transaction of original message (it’s optional)

 

Creating Orchestration:

We need to create orchestration same like as below if you are not adding more business complexity.

BizTalkErrorOrch.jpg

1st Step:

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.

2nd Step:

At receive location of orchestration, receive port should be Direct type.

3rd Step:

Apply appropriate filter at receive shape. Mostly we define below types of filter at receive shape.

ReceiveFilter.jpg

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:

ReceiveFilter2.jpg

4th Step:

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.

MessageCode.jpg

5th Step:

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.

Advertisements

One thought on “Handling Port level exception through orchestration

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s