简体   繁体   English

PHP SOAP xml响应无法解码xml标签

[英]PHP SOAP xml response not decode xml tags

SOAP server try to return corrupted xml, and I'm getting error: looks like we got no XML document SOAP服务器尝试返回损坏的xml,但出现错误: looks like we got no XML document

Corrupted xml looks like: 损坏的xml看起来像:

<loyaltyReturn xsi:type="xsd:string">&lt;?xml version="1.0"?&gt;
&lt;

Code is: 代码是:

ob_start();
$response = $this->soap->handle();
echo $response;

$out = ob_get_contents();

ob_end_clean();

echo $out;

exit;

I try add echo html_entity_decode($response); 我尝试添加echo html_entity_decode($response); but still not work, where can be problem with encoding ? 但仍然无法正常工作,编码可能会出现问题?

First of all SoapServer::handle returns no response. 首先, SoapServer :: handle不返回任何响应。 Construction like 建设像

$response = $this->soap->handle();
echo $response;

does not make much sense to me. 对我来说没有多大意义。

Secondly, patching corrupted request is a slippery slope. 其次,修补损坏的请求是一个滑坡。 Don't encourage clients to send you junk and expect sensible response. 不要鼓励客户向您发送垃圾邮件,并期望做出明智的回应。 You take a lot of responsibility to make weak assumptions which leads to unpredictable behaviour and hidden bugs in your server implementation. 您要承担很多责任,以做出较弱的假设,这会导致无法预测的行为以及服务器实现中的隐患。

The SOAP server should accept valid SOAP Envelope and reject everything else. SOAP服务器应接受有效的SOAP信封,并拒绝其他所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM