问题
I have to talk to a remote remote SoapServer that has a string field MessageXML
where I have to put in unescaped XML that is encapsualated in CDATA.
I am trying to use php's default \SoapClient
.
My $payload
looks like this:
<![CDATA[<DepartureDate>01/12/2015-01/12/2016</DepartureDate>]]>
Yet when requesting the Soap service via:
$client->ThatMethod(['MessageXML' => $payload];
I can see that the actual response gets escaped in the process via:
$lastRequest = $client->__getLastRequest();
string (1055) "<?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_SERVICE"><SOAP-ENV:Body><ns1:ThatMethod><ns1:MessageXML><![CDATA[<DepartureDate>01/12/2015-01/12/2016</DepartureDate>]]></ns1:MessageXML></ns1:SearchBySea></SOAP-ENV:Body></SOAP-ENV:Envelope>"
I do realize that this is expected behaviour, yet it seems that the Soap remote cannot handle escaped data. This is why I don't want to escape the payload.
How to set the parameter that it accepts raw unescaped data?
来源:https://stackoverflow.com/questions/33521051/how-to-disable-auto-escaping-of-html-entities-in-php-soapclient