SOAP-UI - 如何在参数中传递 xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5715404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SOAP-UI - How to pass xml inside parameter
提问by RedEagle
In SOAP-UI I am making a request to a web service like this:
在 SOAP-UI 中,我向这样的 Web 服务发出请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xxx="http://xxx.call/">
<soapenv:Header/>
<soapenv:Body>
<cotf:call_XXX>
<!--Optional:-->
<arg0>
<!--Optional:-->
<parameter1>some text</parameter1>
<!--Optional:-->
<parameter2>XML string</parameter1>
</arg0>
</cotf:call_XXX>
</soapenv:Body>
</soapenv:Envelope>
What I would like to know is how I can pass an XML string on parameter 2 since if I put the XML string directly it assumes the XML string nodes as request parameters....
我想知道的是如何在参数 2 上传递 XML 字符串,因为如果我直接放置 XML 字符串,它将假定 XML 字符串节点作为请求参数......
Thanks
谢谢
回答by Alin Purcaru
Either encode the needed XML entities or use CDATA.
编码所需的 XML 实体或使用 CDATA。
<arg0>
<!--Optional:-->
<parameter1><test>like this</test></parameter1>
<!--Optional:-->
<parameter2><![CDATA[<test>or like this</test>]]></parameter2>
</arg0>
回答by bitsmonkey
回答by Randnum
To send CDATA in a request object use the SoapObject.setInnerText("...");method.
要在请求对象中发送 CDATA,请使用该SoapObject.setInnerText("...");方法。

