How to disable auto-escaping of HTML entities in php \SoapClient?

风流意气都作罢 提交于 2019-12-10 23:06:36

问题


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>&lt;![CDATA[&lt;DepartureDate&gt;01/12/2015-01/12/2016&lt;/DepartureDate&gt;]]&gt;</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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!