Executing BTAHL7ReceivePipeline in an orchestration

Home Page Forums BizTalk 2004 – BizTalk 2010 Executing BTAHL7ReceivePipeline in an orchestration

Viewing 1 reply thread
  • Author
    Posts
    • #18684

      Hi all:
       
      I am trying to execute the BTAHL7ReceivePipeline inside an orchestration, the idea is to take a string variable with the HL7 content and convert it to a BTAHL7 message through the pipeline, this is what i am trying:

      HL7Request = new System.Xml.XmlDocument();
      HL7Request.LoadXml(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’ contains the HL7 content, ‘HL7Request’ is a System.String message i pass to the pipeline and ‘HL7Request2’ is the message i get from the pipeline with the BTAHL7 format.  

      My problem is that when i execute the BTAHL7ReceivePipeline, it says 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

      %u00bfAny idea?

    • #18791

      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

      • #25465

        Hi Mihai Dan,

        With all  appreciation I read your  reply in Biztalk Guru Blog  regarding Executing BTAHL7ReceivePipeline and the resolution  you have suggested  looks like  to  fit my requirement and if is this some thing  you be able to help me and advice how i can proceed further,with your reply I will be looking forward  to.

        Here is my email Contact  [email protected].

        Hope to hear  from you ASAP.

        Expecting you help and appreciate you advice.

        Thanks

        Raj

         

         

         

         

         

        • #25986

          Issue: Getting HL7 data via SOAP and sending to HL7 Receive pipeline by extracting string HL7 data from SOAP XML and calling the custom pipeline (pipeline with custom data formatting routine to format line breaks etc and passing to HL72x DASM).

          I am keep getting the error executing the object reference not set errof when calling GetCurrent(msgQBP) — see below for code. Any thoughts what would cause it? Below is the code that I am using.

          xmlDoc=msgImmunizationHistoryResponse;

          InputPipeline = Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(typeof(HL7SourceQBPRecvPipeline), msgImmunizationHistoryResponse);

          //Initialize

          msgQBP.MSHSegment = new System.Xml.XmlDocument();

          msgQBP.BodySegments = new System.Xml.XmlDocument();

          msgQBP.ZSegments = "";

          InputPipeline.MoveNext();

          InputPipeline.GetCurrent(msgQBP);

          Any help would be appriciated.

          Thanks,

          -Harshal

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.