Posted by: techsavygal | January 23, 2006

Handling Exceptions in Orchestrations using BTS 2004…

Exceptions raised in orchestrations in BizTalk Server 2004 & 2006 are handled as Dotnet exceptions. The following actions generate an exception:

  1. Forced termination A sibling branch in a surrounding scope invokes the Terminate shape for the orchestration, throwing a Microsoft.XLANGs.BaseTypes.ForcedTerminationException instance.


Responses

  1. Nice article which covered thoroughly the exception handling capability available with BizTalk server 2004. I would like to share some of my thoughts for real time error handling in orchestration. Often it is found that, in real time development scenario, a logger component/helper class is helpful to track the errors for the messages and either sending this information to the administrator as a file through email or save in the disk with timestamp so that the administrator can view the details and figure out the reason of the error and when the error happened etc..

    One of the simple approach could be like this.

    1. Create a serializable class say “Exception” where we can define the variables like timestamp, description, message etc.. and implement the set/get method.
    2. Create a schema with elements described in the above “exception” class.
    3. Create another class with two static methods as given below.

    For example

    public static void SetMsg(Exception excp, XmlDocument mesg)
    {
    excp.Message = mesg.OuterXml;
    }

    public static System.Xml.XmlDocument
    GetMsg(ExceptionInfo excp)
    {
    string strxml = string.Format(
    “” +
    ” {0}” +
    ” {1}” +
    ” {2}” +
    ” {3}” +
    “”
    , excp.Desc, XmlConvert.ToString(excp.TimeStamp),
    excp.Orchestration, excp.Message );
    XmlDocument doc1 = new XmlDocument();
    doc1.LoadXml(strxml);
    return doc1;

    Now in the catch block, in an expression shape we can set the values for the variables defined in “exception” class and call SetMsg method.
    Attaching a message construct shape, we can call the GetMsg and send this message where ever we want to send through send port.

    With this basic idea, we can build a complex logger component which will trace all the success and failure transactions in different file and track the entire process.

  2. Thanks for sharing this information Abhijit!

  3. Thanks for sharing this information, Abhijit!

  4. Lakshmi,

    It’s helpful for me.
    Can you put exception handling sample? it would be great for us.

    Thanks,
    Raja

  5. […] Handling Exceptions in Orchestration […]

  6. Sign: wdpad Hello!!! mcbxy and 3945fqqgcvgtkz and 5855 : Thanks. We look forward to hearing from you again and for your opinions on the world of work.

  7. Sign: zdbrw Hello!!! wknma and 5024mzhtuczgse and 2391 : I love your blog. 🙂 I just came across your blog.


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: