soapUI (or tools such as curl) test webservice, parameters with xml processing

soapUI is a tool we commonly use to test webservice.

If our parameter is xml

as follows:

<root>
	<id>1</id>
	<name>Mike</name>
</root>

In the case of soapUI parsing, it will assume that the <root> type is a node, resulting in the parameter not being passed correctly

Solution:

Wrap a layer in xml <! [CDATA [xml content ...]]>

As the above xml is

<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<root>
	<id>1</id>
	<name>Mike</name>
</root>]]>

Similarly, if the parameters in curl have xml, they also need to be escaped and the example of calling webservice is as follows:

curl -H 'Content-Type:text/xml;charset=utf-8' -d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pub="http://publish.service.boco.com/"><soapenv:Header/><soapenv:Body><pub:call><reqData><![CDATA[<wsParam><code>WS_WIRELESS_CODE</code></wsParam>]]></reqData></pub:call></soapenv:Body></soapenv:Envelope>' http://restar.gmcc.net:9044/ws/common?wsdl
Published 69 original articles · Like 72 · Visit 240,000+

Guess you like

Origin blog.csdn.net/londa/article/details/97932828