I am trying to call the BTAHL7ReceivePipeline inside an orchestration
to create and HL7 message from a string variable with the content of
an HL7 file.
I am trying to make this:
HL7Request = string;
BTAHL7ReceivePipeline =
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(BTAHL72XPipelines.BTAHL72XReceivePipeline),
HL7Request);
HL7Request2.MSHSegment = new System.Xml.XmlDocument();
HL7Request2.BodySegments = new System.Xml.XmlDocument();
HL7Request2.ZSegments = new System.Xml.XmlDocument();
BTAHL7ReceivePipeline.MoveNext();
BTAHL7ReceivePipeline.GetCurrent(HL7Request2);
Where ’string’ represents the HL7 content, ‘HL7Request’ is a
System.String message and ‘HL7Request2′ is a BTAHL7 message.
When i try to make this, it gives me the following error:
“Message has an invalid header, it could be due to error in 1st/2nd
field or the segment name is neither MSH nor FHS
”
I have checked the hl7 content and is ok, it seems that the pipeline
is not receiving the content correctly and it fails, i don´t know how
to make this work…
Does anyone have any idea?
Mihai Dan
PS
I just did a simple test and it works fine for me.
"Gerardo Barea" <Gerardo Ba...@discussions.microsoft.com> wrote in message
news:B37F7210-D343-40D0...@microsoft.com...
> to make this work.
The problem is in the way i must pass the System.String message to the
BTAHL7ReceivePipeline, something is wrong with that message or i must pass it
in another way.
I have tried to pass it like a RawString message but it also fails.
Mihai Dan
"Gerardo Barea" <Gerard...@discussions.microsoft.com> wrote in message
news:5181506B-93FF-4A19...@microsoft.com...
It seems that the BTAHL72XReceivePipeline needs to receive a message
constructed in a particular way to work, i am going to try to copy the
incoming message of your example, or i will try to create a custom pipeline
that extracts the HL7 message and call the BTAHL7 pipeline components.
¿Any other suggestion?.
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
"Gerardo Barea" <Gerard...@discussions.microsoft.com> wrote in message
news:207D12B9-E373-49D7...@microsoft.com...
As i suspected and you resolved, the problem was in the way i was creating
the incoming message.
Thank you very very much!
"Mihai Dan" wrote:
> 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
thank you
I am doing in a message assignment;
/*
OutputMessage -- A internal message from defined schema.
OutputMessage.MsgContent -- A distinguished field of OutputMessage take
"MSH|^~..."
HL7Content -- A message of System.XmlDocument type.
*/
CreateHL7Message(OutputMessage.MsgContent, HL7Content)
BTAHL7ReceivePipeline =
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(BTAHL72XPipelines.BTAHL72XReceivePipeline),
HL7Content);
But I get the error:
in xLANG. have I done something wrong? Can you share me with your orginal
project?
Thank,
Honk
"Mihai Dan" wrote:
> 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
I am able to successfully execute the ReceivePipeline but when I configure
ACK messages, it fails. I get the error "Object reference not set to an
instance of an object.." Is there a configuration trick to also receive the
ACK/NACK messages from the pipeline after HL7 parsing.
"Mihai Dan" wrote:
> 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