SOAP 返回无效的 XML 响应

发布于 2025-01-08 15:25:29 字数 1405 浏览 0 评论 0原文

我正在使用 Zend_Soap_Client 对象向另一个应用程序发送肥皂请求,这是它发送到服务器的 XML 格式:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urllocation" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><ns1:isAccountActive env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"><param0 xsi:type="xsd:string">thisisatest</param0></ns1:isAccountActive></env:Body></env:Envelope>

我在我拥有的其他 SOAP 服务器上使用它,并且似乎工作正常,但其中之一服务器返回了一个响应“无效的 XML”,这就是为什么我真的想知道为什么它不能单独在该服务器上工作。任何想法将不胜感激。

其他详细信息

我尝试注释掉从服务器调用该方法的代码,这里是代码:

$client = new Zend_Soap_Client(null,
            array(
                'uri'=>'http://'.$user->customconfigs['alumniuri'],
                'encoding'=>'UTF-8',
                'location'=>'http://'.$user->customconfigs['alumnilocation']
            )
        );
        echo "Location: {$user->customconfigs['alumnilocation']} - uri: {$user->customconfigs['alumniuri']}";
        $alumniactive = $client->isAccountActive($token);

注释掉后:

$alumniactive = $client->isAccountActive($token);

错误消失了。这与我的其他应用程序中的代码相同,并且正在工作从那里很好。

I'm using Zend_Soap_Client object for sending a soap request to another application here is the format of the XML that it's sending to the server:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urllocation" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"><env:Body><ns1:isAccountActive env:encodingStyle="http://www.w3.org/2003/05/soap-encoding"><param0 xsi:type="xsd:string">thisisatest</param0></ns1:isAccountActive></env:Body></env:Envelope>

I'm using it on the other SOAP servers that I have and seems to work fine but one of the server returned a response "Invalid XML" that is why I'm really wondering why it won't work on that server alone. Any ideas would be greatly appreciated.

Additional Details:

I've tried to commentout the code that calls the method from the Server here is the code:

$client = new Zend_Soap_Client(null,
            array(
                'uri'=>'http://'.$user->customconfigs['alumniuri'],
                'encoding'=>'UTF-8',
                'location'=>'http://'.$user->customconfigs['alumnilocation']
            )
        );
        echo "Location: {$user->customconfigs['alumnilocation']} - uri: {$user->customconfigs['alumniuri']}";
        $alumniactive = $client->isAccountActive($token);

upon commenting out:

$alumniactive = $client->isAccountActive($token);

the error disappeared.This is the same codes from my other applications and it's working fine from there.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

演出会有结束 2025-01-15 15:25:29

经过长时间搜索这个问题的答案,我终于发现了问题......这段代码实际上位于 joomla 组件上,我使用的 uri 与我从包含字符“&”的位置获得的 uri 相同。这在 xml 标准上是非法的,从我的 xml 中删除这些字符将导致 SOAP 服务器接受有效的请求。 :)

After a long search for the answer to this question I finally found the problem... this code is actually located on a joomla component which I was using the uri same as what I have from the location that would include a character "&" which is illegal on xml standards removing these character from my xml will then cause the SOAP server to accept the request as valid. :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文