{tocify} $title={Table of Contents}
It allows to deal with any exception (being generic in nature- for all exceptions) it may catch and re-throw, but you can't get the exception message at that point.
You can have your own mechanism built to send a customized message to the user but unfortunately not the exact exception message.
Introduction
In BizTalk we have two ways of defining a solution, one is messaging solution and the orchestration based solution.
Exceptions are the events in which some expected or unexpected scenarios takes place which are not the happy path(normal flow).
While we design solution, some of the exceptions can be identified(known events which we are aware of) but some events can't be identified.
Thus the approach should be to include exception handling mechanism/process to first address specific exception event and then finally to add process to handle events the which are not known.
Exception handling in BizTalk in two categories
1. Handling exception on port level
2. Handling exception in orchestration
Handling exception on port level
Whenever there is a failure or some exception in the messaging solution the messages gets suspended and whatever message gets failed, all the promoted properties are demoted and error properties are populated.
BizTalk creates a clone of that particular failed message where properties related to error are populated and promoted.
Which are made available and can be used to create exception handling process like for example you can route the failed messages to a folder by subscribing to this error related property
Few of the properties which are available are
- ErrorReport.Description
- ErrorReport.ErrorType
- ErrorReport.FailureCode
- ErrorReport.FailureType
- ErrorReport.FailureCategory
- ErrorReport.FailureInstanceID
- ErrorReport.FailureMessageID
- ErrorReport.Failuretime
- ErrorReport.MessageType
- ErrorReport.ReceivePortName
- ErrorReport.InboundTransportLocation
- ErrorReport.SendPortName
- ErrorReport.OutboundTransportLocation
- ErrorReport.RoutingFailureReportID
- ErrorReport.ProcessingServer
Handling exception in orchestration
For handling exception in BizTalk orchestration, scope (None or Long Running) shape is to be added associating it with Exception Handling Block :
1. We first define the Exception Object Type in the properties tab of Exception Block.
2. If your intention is to handle specific exception (suppose, you want to handle SOAP exception) then select that type and also give a name to that object.
3. This object holds the error information when exception occurs.
4. You can use the Message Assignment shape and assign this object to the message you want to send.
e.g, i. You have named your object as soapExceptionObject
ii. You want to send fault_message after an exception occurs
iii. Assign fault_message = soapexceptionObject; in Message assignment shape
4. For general exception set Exception Object Type to General Exception.
5. Here you don't have the privilege of naming the exception object.
General Exception in BizTalk is similar to a try-catch block but it does not have the exception object, so it's not possible to get the exception object.
1. We first define the Exception Object Type in the properties tab of Exception Block.
2. If your intention is to handle specific exception (suppose, you want to handle SOAP exception) then select that type and also give a name to that object.
3. This object holds the error information when exception occurs.
4. You can use the Message Assignment shape and assign this object to the message you want to send.
e.g, i. You have named your object as soapExceptionObject
ii. You want to send fault_message after an exception occurs
iii. Assign fault_message = soapexceptionObject; in Message assignment shape
4. For general exception set Exception Object Type to General Exception.
5. Here you don't have the privilege of naming the exception object.
General Exception in BizTalk is similar to a try-catch block but it does not have the exception object, so it's not possible to get the exception object.
It allows to deal with any exception (being generic in nature- for all exceptions) it may catch and re-throw, but you can't get the exception message at that point.
You can have your own mechanism built to send a customized message to the user but unfortunately not the exact exception message.
If you have questions or suggestions, feel free to do in comments section below !!!
Do share if you find this helpful .......
Knowledge Sharing is Caring !!!!!!
Related Post
- BizTalk Server: Multiple XML files to Single FlatFile Using File Adapter
- BizTalk 2013: Inserting RawXML (Whole Incoming XML Message) in SQL database
- BizTalk 2013: Inserting RawXML (Whole Incoming XML Message) in SQL database - Part 2
- Is it possible to have Map Chaining on the Port Level
- Promoting custom context property using Pipeline Component
- Custom ZipReceivePipeline to Unzip Multi-Type Messages
- Grouping and debatching Inbound Messages from WCF SQL Adapter - BizTalk 2010
- Polling data from SQL using WCF-SQL Adapter in BizTalk 2010 - TypedPolling(From Multiple table)
- Grouping XML Messages using custom XSLT- BizTalk 2010
- Insert Records in SQL Server using WCF-SQL Adapter in BizTalk 2010 - Composite operation(Multiple Records insertion)
- Insert Records in SQL Server using WCF-SQL Adapter in BizTalk 2010- Composite Operation (Message Transformation Pattern)
- Debatching(Splitting) XML Message - BizTalk 2010
- Debatching(Splitting) XML Message in Orchestration using DefaultPipeline - BizTalk 2010