我们的SOAP请求不起作用,因为似乎SOAP正在将我们的XML字符串转换为<
和>
$client = new SoapClient("https://some-test-url/xxx.asmx?wsdl", array('trace' => true) );
$soapparams = array (
"UserName" => 'uname',
"Password" => 'pword',
"GroupID" => 1,
"xmlstring" => '
<![CDATA[
<DocumentElement>
<tbl>
<var1>Q</var1>
<var2>W</var2>
<var3>E</var3>
</tbl>
</DocumentElement>
]]>
'
);
$response = $client->__soapCall('functionHere', array($soapparams));
$raw_request_header = $client->__getLastRequestHeaders();
$raw_request_body = $client->__getLastRequest();
$raw_response_body = $client->__getLastResponse();
echo "<br /><br />Raw Request: ";
echo "<code>";
print htmlentities($raw_request_body);
echo "</code>";
我得到了这个:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
<ns1:functionHere>
<ns1:UserName>uname</ns1:UserName>
<ns1:Password>pword</ns1:Password>
<ns1:GroupID>1</ns1:GroupID>
<ns1:xmlstring>
<![CDATA[
<DocumentElement>
<tbl>
<var1>Q</var1>
<var2>W</var2>
<var3>E</var3>
</tbl>
</DocumentElement>
]]>
</ns1:xmlstring>
</ns1:functionHere>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
如何防止这种情况发生?我希望有人可以帮助我们。