使用 SoapHeader() 调用将 .NET 语法转换为 PHP
我需要使用 SoapHeader() 调用将此 .NET 语法转换为 PHP。
esb.RequestServerVersionValue = new RequestServerVersion(); esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
多谢! :)
I need to convert this .NET syntax into PHP using SoapHeader() call.
esb.RequestServerVersionValue = new RequestServerVersion();
esb.RequestServerVersionValue.Version = ExchangeVersionType.Exchange2007_SP1;
Thanks a lot! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
$client->__setSoapHeaders($soapHeader);
这基本上就是真正需要设置的全部内容。 我对命名空间设置感到困惑。 奇怪的是,在使用公用文件夹时需要 RequestServerVersion 标头,但在 Exchange 2007 中使用邮箱项目时似乎不需要。
此链接特别有用:http://www.zimbra.com/forums/developers/5532-php -soap-vs-zimbra.html 因为它向我展示了如何启用调试并非常清楚每个属性的作用。
此 Google 搜索结果显示了生成此功能所需的有效 XML“t:RequestServerVersion”
$client->__setSoapHeaders($soapHeader);
This is basically all that really needed to be set. I got confused with namespace settings. Curiously, RequestServerVersion header is required when working with public folders, but does not appear to be required when working with mailbox items in Exchange 2007.
This link was particularly helpful: http://www.zimbra.com/forums/developers/5532-php-soap-vs-zimbra.html as it showed me how to enable debugging and made it very clear what each attribute did.
This Google search result shows valid XML necessary to generate for this to work "t:RequestServerVersion"
我个人在使用
SoapHeader
类时从未设法按照我想要的方式获取标头。 为了更加灵活,您也许应该采用自定义SoapClient
类考虑在内。 正如我在另一个问题中回答的那样因此,您可以在覆盖SoapClient 时根据需要构造 SOAP 消息: :__doRequest()
。 这样您就可以随意插入 XML 片段。T_NAMSPACE
必须更改为前缀t
的正确命名空间。I personally never managed to get the headers the way I wanted them when using the
SoapHeader
class. To be more flexible you should perhaps take a customSoapClient
class into consideration. As I answered in another question on SO you can structure the SOAP message to your needs when overridingSoapClient::__doRequest()
. That way you can insert XML fragments at will.T_NAMSPACE
must be changed to the correct namespace of prefixt
.