In Orchestration when there is requirement is that all the exception should be logged into ESB Management Portal or ESB Exception Database, then we need to add some code in orchestration catch block to send exception to ESB Exception Db and Management Portal.
We need to follow the below process to send exception details to BizTalk ESB
- Firstly we need to add bellow dlls in reference of the project. you can get these dlls in GAC
2. Add exception massage in orchestration with Message Type Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage
3. In catch block create a message Assignment shape and write below code
ExceptionMsg = Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();
ExceptionMsg.FailureCategory = “SystemException”;
ExceptionMsg.FaultSeverity = Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Error;
ExceptionMsg.FaultDescription = systemException.Message.ToString();
You can change the message description according Business requirement. In last line AddMessage function contains Exception message first and then provide that message which you want to get from ESB Portal.
4. Create a Correlation type and corresponding correlation set with below property assign in correlation type:
5. Define Correlation Sets
6. Create a send port and assign exception message and initiate correlation set as define above.
7. Port Configuration should always be direct binding for this send port. As below screenshot.
Now build and deploy the application.