Sie sind auf Seite 1von 6

Exception handling using ESB Toolkit 2.

0 exception framework
The exception management system provided by ESB toolkit 2.0 can be leveraged to catch exceptions occurring in a BizTalk orchestration and view them in the ESB management portal along with the customized details of the exception. The management portal provides a birds eye view of all the exceptions caught and gives a graphical chart based representation for the same. The exception is caught as a fault message and the original message causing the fault can also be bound to the fault message for viewing in the management portal. The management portal allows the original message to be viewed, edited, and re-submitted using the receive pipeline for further processing after correcting the error. Further, erring messages can be sent to specific locations for business users to view them and make changes to the messages and resubmit the same to the BizTalk engine for further processing after corrections.

Catching exceptions to view in management portal


1. Put the business process where you want to catch exception in a Scope. 2. Create a message of type Microsoft.Practices.ESB.ExceptionHandling.Schemas.Faults.FaultMessage Add exception handler to the scope within which create the fault message as:
FaultMessage=Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.Cr eateFaultMessage(); FaultMessage.FailureCategory="General Failure"; FaultMessage.FaultCode="10010"; FaultMessage.FaultDescription=excep.Message; FaultMessage.FaultSeverity=Microsoft.Practices.ESB.ExceptionHandling.Fa ultSeverity.Severe; Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(Faul tMessage,ChildSeatReq);

All the above attributes of Fault message can be customized. AddMessage method allows you to add original and other associated messages to the fault message. 3. The fault message can now be sent to MessageBox DB via Direct bound send port. 4. Once your solution is deployed, add a reference to the application Microsoft.Practices.ESB. 5. A send port in Microsoft.Practices.ESB application (ALL.Exceptions) using the inbuilt pipeline component ESBFaultProcessor catches all fault messages and submits it to the ExceptionDB.

6. All saved exception in ExceptionDB can now be viewed in ESB management portal

7. The details of the exception as written to the fault message and other details will be shown as below. The messages attached to the fault message can be seen at the bottom.

8. Further, the management portal allows the user to edit and resubmit the message after making corrections to it.

Allowing users to modify and resubmit messages using InfoPath


1. The basic steps to capture the exception as a fault message and assign the original message to the fault message remain the same as above. 2. Create a new orchestration to send messages with errors to a file location where the user can edit and re-submit them using InfoPath. 3. In the Receive shape of the orchestration subscribe to the Fault message and provide a filter expression like the one below if you want particular messages to be picked up on

4. You can now construct a new message which extracts the original message from the fault message using expression shape like:
ResubmitMsg=Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.Get Message(FaultMsg,"ChildSeatReq");

5. Send this message to a file location where the user can edit it using the below mentioned send port. 6. Create a send port which uses XML transmit pipeline for sending this message and add processing instruction to Assemble stage as below:
<?mso-infoPathSolution solutionVersion="1.0.0.4" productVersion="11.0.6565" PIVersion="1.0.0.0" href="file:///D:\SaiPrateek\ExceptionHandlingTest_Soln\ChildSeatReqForm .xsn" name="urn:schemas-microsoftcom:office:infopath:ChildSeatReqForm:http---DynamicMapCallBizTalkProject-ChildrenSeatRequest" language="en-us" ?><?msoapplication progid="InfoPath.Document"?>

In the above instructions, fill out the correct solutionVersion, productVersion, PIVersion as aplicable. The href points to the xsn file which is the InfoPath template for the message posted. Name is the form template ID of the xsn (Properties). The process to create and associate InfoPath template to the file location is described in subsequent steps.

7. Create an InfoPath template that confirms to the message schema and allows for submission of this message. For submission of the message, we have chosen the HwsMessage web service which comes installed as part of ESB framework and has a method for re-submission to BizTalk MessageBox. Save it in the location specified in the processing instructions above. 8. Choose the Sending mode (Tools>>Submit Options) as Web Server (HTTP) with URL http://localhost/HwsMessages/BTSHTTPReceive.dll?esbexcresubmit

You can use custom code for specifying sending options not present here. 9. In case of an error, the message is now dropped to the location for editing and re-submission. The processing instruction allows the message to be de-serialized for opening in InfoPath as per the template. 10. On clicking the Submit button, the form will be submitted to BizTalk MessageBox DB, from where it can be picked up by the processing orchestration for further processing.

Das könnte Ihnen auch gefallen