#1
|
|||
|
|||
![]()
I'm making a call to a webservice. In the 2nd destination I'm getting the response. How can I make that get sent to whereever without this data infront of the hl7 message:
SUCCESS: <?xml version="1.0" encoding="UTF-8" standalone="no"?><env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><env:Header/><env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><m:getResultsResponse xmlns:m="http://medplus.com/resultsHub/observations"><result xmlns:n1="java:com.medplus.serviceHub.results.webs ervice" xsi:type="n1:ResultsResponse"><HL7Messages soapenc:arrayType="xsd:string[16]"><string xsi:type="xsd:string">MSH|^~\&|LAB|HOU||213580 0|20091116165831|... and this inbetween the MSH messages: </string><string xsi:type="xsd:string"> There are multiple MSH messages in the returned response. I need to save them individually to a database. Thanks, Rut |
#2
|
||||
|
||||
![]()
It sounds like you're using the .toString() function of the response object, which happens if you reference it like this:
Code:
responseMap.get('Destination 1') Code:
$r('Destination 1') Code:
var response = $r('Destination 1').getMessage(); Code:
var rsp = new XML(response);
__________________
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. ![]()
|
#3
|
|||
|
|||
![]()
I think that may be part of my problem. I'm not too much up on using namespaces to parse the xml.
Is there a simple way to take the response and pull out each complete hl7 message? Thanks |
#4
|
||||
|
||||
![]() Quote:
Code:
rsp = new XML($r('Destination 2').getMessage()); var env = new Namespace('http://schemas.xmlsoap.org/soap/envelope/'); var m = new Namespace('http://medplus.com/resultsHub/observations'); for each (str in rsp.env::Body.m::getResultsResponse.result.HL7Messages.string) // Insert into a database, etc.
__________________
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. ![]()
|
#5
|
|||
|
|||
![]()
Thanks. This worked perfectly.
Rut |
#6
|
|||
|
|||
![]()
But now to throw a kink into the works. I'm supposed to use a different call to the webservice that actually returns the same data but the hl7 messages are byte encoded. How can I use the above code and also decode them back to a string?
Rut |
#7
|
|||
|
|||
![]()
Ok. I have this working now and decoding the message. In the transformer step I have this code:
msgReturned = new XML(responseMap.get('Destination 1').getMessage()); var env = new Namespace('http://schemas.xmlsoap.org/soap/envelope/'); var m = new Namespace('http://medplus.com/resultsHub/observations'); for each (str in msgReturned.env::Body.m::getHL7ResultsResponse.res ult.HL7Messages.HL7Message.message) { //logger.info('in for'); var decoded; decoded = org.apache.commons.codec.binary.Base64.decodeBase6 4(str); //logger.info('decoded ' + decoded); } This is working fine. I can get the individual hl7 messages as a string in the for loop. Now how do I send them to the output of the channel as individual xml messages? Thanks, Rut |
![]() |
Thread Tools | |
Display Modes | |
|
|