How to escape ampersand (&) in soap UI

34,154

You could wrap the payload inside <![CDATA[]]> and not worry about escaping:

<![CDATA[<request>
    <request-attributes>
        <message>"this & and that"</message>
    </request-attributes> 
</request>]]>
Share:
34,154
Admin
Author by

Admin

Updated on July 19, 2022

Comments

  • Admin
    Admin almost 2 years

    I am using soap UI (from smartbear) to send soap requests in xml format as :

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsg="http://wsg.hpos.om.hp.com/">
       <soapenv:Header/>
       <soapenv:Body>
          <wsg:abc>
          <wsg:contract>
             &lt;request&gt;
    
             &lt;request-attributes&gt;
                &lt;message&gt;"this &amp; and that"&lt;/message&gt;                
             &lt;/request-attributes&gt;             
             &lt;/request&gt;             
             </wsg:contract>
          </wsg:abc>
       </soapenv:Body>
    </soapenv:Envelope>
    

    and the response is : Invalid request. Could you please throw light on how to escape &? Thanks

  • Daniel Williams
    Daniel Williams about 2 years
    You can also wrap individual elements in CDATA as needed.