Archive

Posts Tagged ‘HL7 multipart message to ESBPortal’

Adding a multipart message to ESB Portal using ESBfault

September 20, 2012 Leave a comment

Assigning a failure message to an ESB fault and making it viewable in ESB Portal is a known practice nowadays.There are many posts that explains how to add a message to ESB fault and to make it displayed in the ESB portal. The sample code would be something like this.

msgESBFault=Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.CreateFaultMessage();
msgESBFault.FailureCategory=”RoutingFailed”;
msgESBFault.FaultSeverity=Microsoft.Practices.ESB.ExceptionHandling.FaultSeverity.Severe;
Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(msgESBFault,ActualMsg);// “ActualMessage is the message  to be sent to ESB Portal”.
 
But when the ”ActualMessage” is a multipart message, assigning the parts to the AddMessage() does not work.
 
Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(msgESBFault,ActualMsg.Part1);
Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(msgESBFault,ActualMsg.Part2);
 
The above way of assigning the part will result in the intellisense complaing that “the message cannot be assigned to an XLangMessage”. To resolve this, the following are the steps.
 
1. Create UnTyped Messages( Type : System.Xml.XmlDocument) for each of the message part to be assigned.

2. Try to assign all the message parts to xmldocument messages and add each one by one as follows.

Msg1(Of type xmldocument) = ActualMsg.Part1;
Msg2(Of type xmldocument) = ActualMsg.Part2;
Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(EsbFault, Msg1);
Microsoft.Practices.ESB.ExceptionHandling.ExceptionMgmt.AddMessage(EsbFault, Msg2);
 

This will display all the parts and the body message to be displayed in the same view in ESB Portal. This will be helpful when HL7 multipart messages are assigned to ESB Faults.

 
Advertisements