Announcement

Collapse
No announcement yet.

Parser XML Webservice

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

  • Parser XML Webservice

    Good. I have a problem when sending a message to a webservice. I am generating this message and I would like to remove the strange symbols and send the message.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http:///">
    <soapenv:Header/>
    <soapenv:Body>
    <typ:consultaElement>
    <typ:msgXml><![CDATA[<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><consultaElement xmlns="http:///"><msgXml>&lt;QBP_Q21 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;amp;&lt;/MSH.2&gt;&lt;MSH.3&gt;&lt;HD.1&gt;MOD_440048&lt;/HD.1&gt;&lt;/MSH.3&gt;&lt;MSH.4&gt;&lt;HD.1&gt;440048&lt;/HD.1&gt;&lt;/MSH.4&gt;&lt;MSH.7&gt;&lt;TS.1&gt;20190308174518+0 100&lt;/TS.1&gt;&lt;/MSH.7&gt;&lt;MSH.8/&gt;&lt;MSH.9&gt;&lt;MSG.1&gt;QBP&lt;/MSG.1&gt;&lt;MSG.2&gt;Q22&lt;/MSG.2&gt;&lt;MSG.3&gt;QBP_Q21&lt;/MSG.3&gt;&lt;/MSH.9&gt;&lt;MSH.10&gt;1493424520587500&lt;/MSH.10&gt;&lt;MSH.11&gt;&lt;PT.1/&gt;&lt;/MSH.11&gt;&lt;MSH.12&gt;&lt;VID.1&gt;2.5&lt;/VID.1&gt;&lt;/MSH.12&gt;&lt;MSH.18&gt;8859/1&lt;/MSH.18&gt;&lt;/MSH&gt;&lt;SFT/&gt;&lt;QPD&gt;&lt;QPD.1&gt;&lt;CE.1&gt;Q22&lt;/CE.1&gt;&lt;CE.2&gt;Busqueda usuario&lt;/CE.2&gt;&lt;CE.3&gt;HL7_471&lt;/CE.3&gt;&lt;/QPD.1&gt;&lt;QPD.3&gt;&lt;CIA&gt;&lt;/CIA&gt;&lt;NIF&gt;&lt;/NIF&gt;&lt;NOM/&gt;&lt;APE1/&gt;&lt;APE2/&gt;&lt;SIT/&gt;*&lt;TIP/&gt;&lt;TEL/&gt;&lt;FNAC/&gt;&lt;CIP/&gt;&lt;NHC/&gt;&lt;/QPD.3&gt;&lt;/QPD&gt;&lt;RCP&gt;&lt;RCP.2&gt;&lt;CQ.1&gt;10&lt;/CQ.1&gt;&lt;/RCP.2&gt;&lt;/RCP&gt;&lt;/QBP_Q21&gt;</msgXml></consultaElement></S:Body></S:Envelope>]]>
    </typ:msgXml>
    </typ:consultaElement>
    </soapenv:Body>
    </soapenv:Envelope>


    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http:///">
    <soapenv:Header/>
    <soapenv:Body>
    <typ:consultaElement>
    <typ:msgXml><![CDATA[<QBP_Q21 xmlns="urn:hl7-org:v2xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><MSH><MSH.1>|</MSH.1><MSH.2>^~\&amp;</MSH.2><MSH.3><HD.1>MOD_440048</HD.1></MSH.3><MSH.4><HD.1>440048</HD.1></MSH.4><MSH.7><TS.1>20190308152434+0100</TS.1></MSH.7><MSH.8/><MSH.9><MSG.1>QBP</MSG.1><MSG.2>Q22</MSG.2><MSG.3>QBP_Q21</MSG.3></MSH.9><MSH.10>1484980317546000</MSH.10><MSH.11><PT.1/></MSH.11><MSH.12><VID.1>2.5</VID.1></MSH.12><MSH.18>8859/1</MSH.18></MSH><SFT/><QPD><QPD.1><CE.1>Q22</CE.1><CE.2>Busqueda usuario</CE.2><CE.3>HL7_471</CE.3></QPD.1><QPD.3><CIA></CIA><NIF></NIF><NOM/><APE1/><APE2/><SIT/>*<TIP/><TEL/><FNAC/><CIP/><NHC/></QPD.3></QPD><RCP><RCP.2><CQ.1>10</CQ.1></RCP.2></RCP></QBP_Q21>]]></typ:msgXml>
    </typ:consultaElement>
    </soapenv:Body>
    </soapenv:Envelope>

  • #2
    Hello mberge,


    you replace the values using javascript code:


    Code:
    yourString.replace(/&lt;/g,'<');
    yourString.replace(/&gt;/g,'>');

    give it a try




    Best Regards
    Best Regards,
    Alex Neiva

    Comment

    Working...
    X