none
ESB Error Handline in Biztalk RRS feed

  • Question

  • Hi All,

    I have Biz-talk orchestration in which i am handling the exception (SOAP).

    I want to add the Error source in Fault exception ? how can i do that ?

    i have added

    FaultMsg.FailureCategory  = "0";

    FaultMsg.FaultDescription = "This is Description";

    FaultMsg.FaultCode = FaultMsg.FaultCode;

    FaultMsg.FaultSeverity = Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error;

    Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(FaultMsg,RequestMessage);


    Thanks and Regards, Nitin.

    Tuesday, October 13, 2015 12:34 PM

Answers

  • Hi Nitin,

    My suggestion would be to route the failed messages by catching the exception  through an Orchestration

    In order to use the ESB exception handling framework you need to reference couple of dlls. Add Reference to the following dlls inside your Orchestration project.

    1. C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\Microsoft.Practices.ESB.ExceptionHandling.dll

    2. C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.dll

    then, Declare a new Orchestration message (ex: MSG_FAULT) and set the MessageType to Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage, which you can find under the "Select from Referenced Assembly" option.

    and, Inside your Exception handling block construct the fault message (the one created in step 2) with relevant information required. The code will look like

    // Create Fault Exception Message
    MSG_FAULT = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage(); 
    
    //Assign some properties
    MSG_FAULT.FailureCategory = "Some User Category";
    MSG_FAULT.FaultDescription = ex.Message;
    MSG_FAULT.FaultCode = "3002002"
    MSG_FAULT.FaultSeverity =
    Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Severe; 
    
    //Add request message (any other message if present)
    Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(MSG_FAULT,MSG_EMP_REQUEST);

    Create a "Direct" bound port and link this logical port with the send shape that's configured to send MSG_FAULT. Since its a Direct bound port no additional port configuration is required from your orchestration apart from your regular business related ones.

    Please have a look into below article for some help,

    Create a Soap Exception Catching Process from an Orchestration Request-Response Port using the ESB Portal


    Thanks, If my reply is helpful please mark as answer or vote as helpful.

    • Proposed as answer by Angie Xu Thursday, October 22, 2015 7:06 AM
    • Marked as answer by Angie Xu Friday, October 23, 2015 5:20 AM
    Tuesday, October 13, 2015 6:55 PM
    Moderator

All replies

  • Hi,

    You can use the  (FaultMsg.Scope= "Source") for the Source and

    (FaultMsg.FailureCategory  = "POFault") in Fault exception.



    Regards, Aboorva Raja R Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, October 13, 2015 5:00 PM
  • Hi Nitin,

    My suggestion would be to route the failed messages by catching the exception  through an Orchestration

    In order to use the ESB exception handling framework you need to reference couple of dlls. Add Reference to the following dlls inside your Orchestration project.

    1. C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\Microsoft.Practices.ESB.ExceptionHandling.dll

    2. C:\Program Files\Microsoft BizTalk ESB Toolkit 2.0\Bin\Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.dll

    then, Declare a new Orchestration message (ex: MSG_FAULT) and set the MessageType to Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage, which you can find under the "Select from Referenced Assembly" option.

    and, Inside your Exception handling block construct the fault message (the one created in step 2) with relevant information required. The code will look like

    // Create Fault Exception Message
    MSG_FAULT = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage(); 
    
    //Assign some properties
    MSG_FAULT.FailureCategory = "Some User Category";
    MSG_FAULT.FaultDescription = ex.Message;
    MSG_FAULT.FaultCode = "3002002"
    MSG_FAULT.FaultSeverity =
    Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Severe; 
    
    //Add request message (any other message if present)
    Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(MSG_FAULT,MSG_EMP_REQUEST);

    Create a "Direct" bound port and link this logical port with the send shape that's configured to send MSG_FAULT. Since its a Direct bound port no additional port configuration is required from your orchestration apart from your regular business related ones.

    Please have a look into below article for some help,

    Create a Soap Exception Catching Process from an Orchestration Request-Response Port using the ESB Portal


    Thanks, If my reply is helpful please mark as answer or vote as helpful.

    • Proposed as answer by Angie Xu Thursday, October 22, 2015 7:06 AM
    • Marked as answer by Angie Xu Friday, October 23, 2015 5:20 AM
    Tuesday, October 13, 2015 6:55 PM
    Moderator
  • Hi Nitin,

    Error information is stored in the exception object of the catch block .With ESB exception handling you are capturing can  System.exception which contains all the relevant information regarding the exception .

    If you are working with Custom exception handling for web service ,then you can refer below codeproject 

    http://www.codeproject.com/Articles/488647/BizTalk-ESB-Exception-Handling-Consuming-WCF-Ser .

    What it does is to create MessageFactory helper class that creates SOAP Faults for when we trap exceptions in your Orchestration

    So your exception message creation will be like below

    ESB.ExceptionHandling.ServiceModel.MessageFactory.CreateSoapFaultMessage(exSoapException);
    mReplyMessage(*) = mInboundMessage(*); 

    Thanks

    Abhishek

    Wednesday, October 14, 2015 5:07 AM