web stats
Using transformed variable in Soap Envelope - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 12-12-2013, 12:31 AM
Davio Davio is offline
What's HL7?
 
Join Date: Dec 2013
Posts: 5
Davio is on a distinguished road
Question 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?
Reply With Quote
  #2  
Old 12-12-2013, 07:30 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 12-12-2013, 10:35 PM
Davio Davio is offline
What's HL7?
 
Join Date: Dec 2013
Posts: 5
Davio is on a distinguished road
Default

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 Images
File Type: jpg Datatypes.jpg (52.5 KB, 60 views)
File Type: jpg XSLT-Step.jpg (73.9 KB, 69 views)
File Type: jpg Destination.jpg (58.7 KB, 64 views)
Reply With Quote
  #4  
Old 12-13-2013, 05:58 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 12-13-2013, 06:18 AM
Davio Davio is offline
What's HL7?
 
Join Date: Dec 2013
Posts: 5
Davio is on a distinguished road
Default

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 at 06:30 AM.
Reply With Quote
  #6  
Old 12-13-2013, 07:50 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

Quote:
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.
Reply With Quote
  #7  
Old 12-16-2013, 10:31 PM
Davio Davio is offline
What's HL7?
 
Join Date: Dec 2013
Posts: 5
Davio is on a distinguished road
Default

I enclosed my channel and a sample message.
You need to rename labresultaten.txt to labresultaten.hl7v2 to make it work.
Attached Files
File Type: xml HL7v2 to HL7v3 CDA.xml (30.9 KB, 46 views)
File Type: txt labresultaten.txt (1,012 Bytes, 31 views)
Reply With Quote
  #8  
Old 12-17-2013, 06:45 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,126
narupley is on a distinguished road
Default

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.
Reply With Quote
  #9  
Old 12-17-2013, 10:21 PM
Davio Davio is offline
What's HL7?
 
Join Date: Dec 2013
Posts: 5
Davio is on a distinguished road
Default

You're welcome!

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

Tags
destination, soap, web services, xslt

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation