Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Executing BTAHL7ReceivePipeline in an orchestration › Re: Executing BTAHL7ReceivePipeline in an orchestration
Mihai Dan has given me the solution to this problem, here it is:
The problem when you define your orchestration message as System.String is
that your message payload is in the following format:
<?xml version=”1.0″?>
<string>MSH|^~\&|… etc…</string>
… which is legitimate considering the message type you have chosen. Same
with the error message you’ve got as the HL7 Dasm expects a payload starting
with MSH or FHS….
Therefore, the trick is to create xlang message with binary (or string)
content instead of xml as we usually do…. so, I wrote the following method
(together with its internal class) that populates my xlang message the way I
want:
public static void CreateHL7Message(string data, XLANGMessage message)
{
message[0].LoadFrom(new HL7StreamFactory(data));
internal class HL7StreamFactory: IStreamFactory
{
private string hl7data = String.Empty;
public HL7StreamFactory(string hl7data)
{
this.hl7data = hl7data;
}
public Stream CreateStream()
{
return new MemoryStream(ASCIIEncoding.ASCII.GetBytes(hl7data));
}
In your MessageAssignment shape the code should look like:
HL7 = null;
CreateHL7Message(hl7data, HL7);
… where HL7 is the output message (created as XmlDocument) in the
orchestration.
I hope that my answer reaches you on time… cheers,
Mihai Dan