如何在soap UI中逃脱&符号(&)

时间:2013-09-23 11:04:43

标签: xml soap xml-parsing soapui

我正在使用soap UI(来自smartbear)以xml格式发送soap请求:

<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>

并且响应是:无效的请求。你能不能说明如何逃避&amp;? 感谢

1 个答案:

答案 0 :(得分:11)

您可以将有效负载包装在<![CDATA[]]>内,而不用担心转义:

<![CDATA[<request>
    <request-attributes>
        <message>"this & and that"</message>
    </request-attributes> 
</request>]]>