Announcement

Collapse
No announcement yet.

Using transformed variable in Soap Envelope

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using transformed variable in Soap Envelope

    I'm using some transformer steps for my destination, which is a Web Service Sender.

    One of the steps, the first, creates an XML string and saves it in a variable called 'cda' (it's a HL7v3 CDA document, generated through XSLT).

    I want to insert this CDA variable in my Soap Envelope like so:

    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:meddex-nl:CdaTest">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:processcda>
             <urn:ClinicalDocument>${XmlUtil.encode(${cda})}</urn:ClinicalDocument>
          </urn:processcda>
       </soapenv:Body>
    </soapenv:Envelope>
    This doesn't work. My output is just the same as this message, literally, nothing gets inserted.

    However, when I use something like this:
    Code:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:meddex-nl:CdaTest">
       <soapenv:Header/>
       <soapenv:Body>
          <urn:processcda>
           <urn:ClinicalDocument>${XmlUtil.encode(${message.transformedData})}</urn:ClinicalDocument>
          </urn:processcda>
       </soapenv:Body>
    </soapenv:Envelope>
    I do see something getting inserted into the message, but it's not the right result.

    So it seems that my variable is unavailable at this point, but why? It appears in the "Destination Mappings" listbox.

    Details for Mirth:
    Mirth Connect Server 3.0.0.6931
    Built on September 30, 2013
    Server ID: 75d1945a-xxxxxxxxxxxxx
    Java version: 1.7.0_40

    Any thoughts?

  • #2
    If you don't have an active transformer, the transformed data will not exist. If your outbound data type is XML, then you can just use message.encodedData instead. If you want to force the transformer to serialize the message and then use the transformed data, just add an empty JavaScript step.
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      I'm still not sure.

      I made some screenshots, maybe they will make my case more clear.
      I think the transformer is active, since when I choose the void-channel destination, I get to see the transformed XML as an output.

      It's only in this Web Service destination that it seems to go wrong.
      Attached Files

      Comment


      • #4
        Why is your source inbound data type HL7 v2.x? Aren't you trying to read in an HL7 v3 document? Also, you probably want to turn off Strip Namespaces. If your variable reference ${cda} is printing out "${cda}" verbatim, that generally means that there's no "cda" variable in any of the maps. That XSLT step should place it in the channel map, assuming there were no errors.
        Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

        Nicholas Rupley
        Work: 949-237-6069
        Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


        - How do I foo?
        - You just bar.

        Comment


        • #5
          My sources are pipe-separated HL7v2 files which my source converts to HL7v2 XML format. That was the easy part. The harder part was converting it to HL7v3 CDA, but I did that with my XSLT Step.

          The final part is sending it to a Web Service.

          No matter what I try, it keeps sending this verbatim string: ${XmlUtil.encode(${cda})}

          Stripping namespaces has no effect.

          EDIT: If I use this: <![CDATA[ ${cda} ]]> it works and sends the contents of the cda variable.
          So there is something about XmlUtil.encode which isn't working correctly for me.
          Last edited by Davio; 12-13-2013, 06:30 AM.

          Comment


          • #6
            Originally posted by Davio View Post
            My sources are pipe-separated HL7v2 files which my source converts to HL7v2 XML format. That was the easy part. The harder part was converting it to HL7v3 CDA, but I did that with my XSLT Step.

            The final part is sending it to a Web Service.

            No matter what I try, it keeps sending this verbatim string: ${XmlUtil.encode(${cda})}

            Stripping namespaces has no effect.

            EDIT: If I use this: <![CDATA[ ${cda} ]]> it works and sends the contents of the cda variable.
            So there is something about XmlUtil.encode which isn't working correctly for me.
            Can you post your channel and a sample inbound message?
            Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

            Nicholas Rupley
            Work: 949-237-6069
            Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


            - How do I foo?
            - You just bar.

            Comment


            • #7
              I enclosed my channel and a sample message.
              You need to rename labresultaten.txt to labresultaten.hl7v2 to make it work.
              Attached Files

              Comment


              • #8
                Okay, I was able to reproduce it and find the issue: MIRTH-3100

                It'll be fixed in the next release. In the meantime, you can get around it by using ${XmlUtil.encode(${cda.toString()})} in your SOAP envelope instead. Thanks for finding it!
                Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

                Nicholas Rupley
                Work: 949-237-6069
                Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


                - How do I foo?
                - You just bar.

                Comment


                • #9
                  You're welcome!

                  I'm glad I wasn't going crazy myself by looking over something obvious.

                  Comment

                  Working...
                  X