Announcement

Collapse
No announcement yet.

Remplace > < Webservice

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

  • Remplace > < Webservice

    I need the answer that a webservice sends me to remove the characters by <> I created this script in the response transform, but I can't change the symbols.

    <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;&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;20191113110503&l t;/TS.1&gt;&lt;/MSH.7&gt;&lt;MSH.8&gt;usr&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;986b5a1b-3291-486e-98f4-98eda22cefcb110503&lt;/MSH.10&gt;&lt;/MSH&gt;&lt;MSA&gt;&lt;MSA.1&gt;AE&lt;/MSA.1&gt;&lt;MSA.2&gt;986b5a1b-3291-486e-98f4-98eda22cefcb&lt;/MSA.2&gt;&lt;/MSA&gt;&lt;ERR&gt;&lt;ERR.3&gt;&lt;CWE.1&gt;36&lt;/CWE.1&gt;&lt;/ERR.3&gt;&lt;ERR.4&gt;E&lt;/ERR.4&gt;&lt;ERR.7&gt;[Parser]
    &lt;/ERR.7&gt;&lt;/ERR&gt;&lt;/ACK&gt;</SingleCallResult>
    </SingleCallResponse>
    </soap:Body>
    </soap:Envelope>


    This is the script that I am using

    var mensaje = response.getMessage();

    var me = mensaje.replaceAll('&lt;', '<').replaceAll ('&gt;', '>');


    return me;

  • #2
    The return value from a transformer isn't used. If you want to do string replacement like that just do:
    Code:
    var mensaje = response.getMessage();
    msg = mensaje.replaceAll('&lt;', '<').replaceAll ('&gt;', '>');
    Then set your outbound type to Raw since msg is now a String.

    If you want to keep it XML straight through, this should work:
    Code:
    var singleCallResult = msg.*::Body.*::SingleCallResponse.*::SingleCallResult;
    singleCallResult.setChildren(new XML(singleCallResult.toString()))

    Comment


    • #3
      If you use the replace all you may need to include the following line. Replace all in a Java function and not a JavaScript function....


      msg = java.lang.String(msg);

      Comment

      Working...
      X