web stats
Edit response webservice - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 10-23-2019, 12:45 PM
mberges mberges is offline
OBX.1 Kenobi
 
Join Date: Jan 2018
Posts: 45
mberges is on a distinguished road
Default Edit response webservice

Good. I need to replace the response of a webservice with these characters.

<soap:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<soap:Body xmlns="http://tempuri.org/">
<SingleCallResponse>
<SingleCallResult>&lt;?xml version="1.0"?&gt;&lt;ACK xmlns="urn:hl7-org:v2xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;MSH&gt;&lt;MSH.1&gt;|&lt;/MSH.1&gt;&lt;MSH.2&gt;^~\&amp;amp;&lt;/MSH.2&gt;&lt;MSH.3&gt;&lt;HD.1&gt;SSD6&lt;/HD.1&gt;&lt;/MSH.3&gt;&lt;MSH.5&gt;&lt;HD.1&gt&lt;/HD.1&gt;&lt;/MSH.5&gt;&lt;MSH.7&gt;&lt;TS.1&gt;20191023214240&l t;/TS.1&gt;&lt;/MSH.7&gt;&lt;MSH.8&gt;&lt;/MSH.8&gt;&lt;MSH.9&gt;&lt;MSG.1&gt;ACK&lt;/MSG.1&gt;&lt;MSG.2&gt;O01&lt;/MSG.2&gt;&lt;/MSH.9&gt;&lt;MSH.10&gt;dfa8f35d-7ee7-4496-8e60-432cf6f26956214240&lt;/MSH.10&gt;&lt;/MSH&gt;&lt;MSA&gt;&lt;MSA.1&gt;AE&lt;/MSA.1&gt;&lt;MSA.2&gt;dfa8f35d-7ee7-4496-8e60-432cf6f26956&lt;/MSA.2&gt;&lt;/MSA&gt;&lt;ERR&gt;&lt;ERR.3&gt;&lt;CWE.1&gt;101&lt ;/CWE.1&gt;&lt;/ERR.3&gt;&lt;ERR.4&gt;E&lt;/ERR.4&gt;&lt;ERR.7&gt;[Parser: [101]: [NewPatient][15] ]
&lt;/ERR.7&gt;&lt;/ERR&gt;&lt;/ACK&gt;</SingleCallResult>
</SingleCallResponse>
</soap:Body>
</soap:Envelope>
Reply With Quote
  #2  
Old 10-23-2019, 12:58 PM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 254
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

Sorry... I'm unclear. This is what you start with and you want to end up with XML, or you have XML and want to HTML-encode it like this?
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #3  
Old 10-23-2019, 01:05 PM
mberges mberges is offline
OBX.1 Kenobi
 
Join Date: Jan 2018
Posts: 45
mberges is on a distinguished road
Default

What I want is to replace the special characters & gt; & lt of the reply message that comes to me from the webservice
Reply With Quote
  #4  
Old 10-23-2019, 01:16 PM
jackwhaines jackwhaines is offline
 
Join Date: May 2011
Location: Kansas City, Missouri
Posts: 254
jackwhaines is on a distinguished road
Send a message via Skype™ to jackwhaines
Default

It's not pretty, but it should get you closer!

Code:
var scr = msg['SingleCallResult'];

logger.info("before: " + scr);

scr = scr.replace(/&lt;/g, "<");
scr = scr.replace(/&gt;/g, ">");

logger.info("after: " + scr);
__________________

-= Jack Haines : Founder/CEO of Healthcare Integrations, LLC
-= jack.haines@HealthcareIntegrations.com
-= Mirth Connect (Advanced)-certified
-= Gold member of HL7.org
-= Available for Mirth Connect channel development and consultation! Schedule a FREE call with me at https://calendly.com/jackhaines
Reply With Quote
  #5  
Old 10-24-2019, 05:54 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,107
agermano is on a distinguished road
Default

E4x automatically handles xml encoding and decoding when you store or access strings.

Code:
logger.info(msg..*::SingleCallResult.toString());
Reply With Quote
Reply

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 08:30 PM.


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