不同的肥皂信封 - 一种有效,另一种失败

发布于 2024-08-27 09:54:02 字数 2059 浏览 14 评论 0原文

我正在发出一个相同的 SOAP 请求,一个使用 Zend Framework,另一个则不使用。 Zend 不工作,唯一的区别似乎是信封命名空间。

信封是如何设置的?为什么其中一个会失败?

Zend Soap 调用

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://wsapi" 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:incomingRequest env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<username xsi:type="xsd:string">myuser</username>
<password xsi:type="xsd:string">mypass</password>
<request xsi:type="xsd:string">&amp;lt;incoming-requests&amp;gt;&amp;lt;request description="getEmailMessageStatus"&amp;gt;&amp;lt;incoming-data&amp;gt;&amp;lt;email-message messageID="messageID"/&amp;gt;&amp;lt;/incoming-data&amp;gt;&amp;lt;/request&amp;gt;&amp;lt;/incoming-requests&amp;gt;</request>
</ns1:incomingRequest>
</env:Body>
</env:Envelope>

PHP Soap 调用

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://wsapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:incomingRequest>
<username xsi:type="xsd:string">myuser</username>
<password xsi:type="xsd:string">mypass</password>
<request xsi:type="xsd:string">&lt;incoming-requests&gt;&lt;request description="getEmailMessageStatus"&gt;&lt;incoming-data&gt;&lt;email-message messageID="messageID"/&gt;&lt;/incoming-data&gt;&lt;/request&gt;&lt;/incoming-requests&gt;</request>
</ns1:incomingRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

I'm making an identical SOAP Request, one using the Zend Framework and the other not. The Zend one is not working and the only difference seems to be the envelope namespace.

How is the envelope set and why would one of them fail?

Zend Soap Call

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://wsapi" 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:incomingRequest env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<username xsi:type="xsd:string">myuser</username>
<password xsi:type="xsd:string">mypass</password>
<request xsi:type="xsd:string">&lt;incoming-requests&gt;&lt;request description="getEmailMessageStatus"&gt;&lt;incoming-data&gt;&lt;email-message messageID="messageID"/&gt;&lt;/incoming-data&gt;&lt;/request&gt;&lt;/incoming-requests&gt;</request>
</ns1:incomingRequest>
</env:Body>
</env:Envelope>

PHP Soap Call

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://wsapi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:incomingRequest>
<username xsi:type="xsd:string">myuser</username>
<password xsi:type="xsd:string">mypass</password>
<request xsi:type="xsd:string"><incoming-requests><request description="getEmailMessageStatus"><incoming-data><email-message messageID="messageID"/></incoming-data></request></incoming-requests></request>
</ns1:incomingRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

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

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

发布评论

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

评论(1

浊酒尽余欢 2024-09-03 09:54:02

我已经弄清楚了。

事实证明,Soap 服务器仅与 SOAP 版本 1.1 兼容。

在 Zend 中,您可以像这样指定版本:

$client = new Zend_Soap_Client('wsdl url', array('soap_version' => SOAP_1_1));

这改变了信封并且 Soap 服务器开始按其应有的方式响应。

I've figured this out.

It turns out, the Soap server is only compatible with SOAP version 1.1.

In Zend, you can specify the version like so:

$client = new Zend_Soap_Client('wsdl url', array('soap_version' => SOAP_1_1));

This changed the envelope and the Soap server began responding as it should.

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