doucai7294
2016-02-01 08:47
浏览 61

PHP SOAP xml响应不解码xml标记

SOAP server try to return corrupted xml, and I'm getting error: looks like we got no XML document

Corrupted xml looks like:

<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); but still not work, where can be problem with encoding ?

图片转代码服务由CSDN问答提供 功能建议

SOAP服务器尝试返回损坏的xml,我收到错误:看起来我们没有XML 文档

损坏的xml如下所示:

 &lt; loyaltyReturn xsi:type =“xsd:string”&gt;&amp;  ; lt;?xml version =“1.0”?&amp; gt; 
&amp; lt; 
   
 
 

代码是:

  ob_start(); 
 $ response = $ this-&gt; soap-&gt; handle(); 
echo $ response; 
 
 $ out = ob_get_contents(); 
 
ob_end_clean(); \  n 
echo $ out; 
 
exit; 
   
 
 

我尝试添加 echo html_entity_decode($ response); 但仍无法正常工作, 哪里可能有编码问题?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • doq70020 2016-02-01 09:46
    最佳回答

    First of all SoapServer::handle returns no response. 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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题