Sunday, October 6, 2013

Handling Exception in BizTalk

For handling exception in BizTalk, 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.
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.

No comments:

Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment