通过 wsHttpBinding 在 PHP 中调用 WCF WebService
我有一个 WCF Web 服务,我可以通过 basicHttp 连接到它,但不能通过 wsHttp 连接到它。我尝试通过以下方式通过 wshttp 连接到它:
$service = new SoapClient
("http://service.companyname.local:6666/Service/?wsdl",
array(
"location" => "http://service.companyname.local:6666/Service/WCF",
"trace" => true,
'soap_version' => SOAP_1_2
)
);
对 SoapClient 构造函数的调用返回正常。当我尝试使用 $client->FunctionName 调用一个时,该页面只是在那里加载了很长一段时间,并最终返回错误“获取 http 标头时出错”。这究竟意味着什么以及如何解决它? (使用 .Net 客户端的服务效果很好。)
I have a WCF webservice I can connect to it via basicHttp, but not wsHttp. I try to conenct to it via wshttp via the following:
$service = new SoapClient
("http://service.companyname.local:6666/Service/?wsdl",
array(
"location" => "http://service.companyname.local:6666/Service/WCF",
"trace" => true,
'soap_version' => SOAP_1_2
)
);
The call to the SoapClient constructor returns fine. When I try to call one using $client->FunctionName, the page just sits there loading for quite a while, and eventually returns the error "Error Fetching http headers". What exactly is this supposed to mean and how do I fix it? (Consuming the service from .Net client works perfectly.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
wsHttpBinding 上的默认配置使用高级 WS-Security 和 WS-Addressing 功能普通 PHP SoapClient 无法理解。还有其他 PHP 可访问的 SOAP 客户端可能可以工作(例如 Apache Axis2+Rampart/C),或者您可以尝试关闭一些不兼容的 wsHttpBinding 功能(消息安全性可能是第一个)。并不是说它不起作用,但您可能需要一些尝试和错误才能使其一切正常。
The default config on wsHttpBinding uses advanced WS-Security and WS-Addressing features that aren't understood by the vanilla PHP SoapClient. There are other PHP-accessible SOAP clients that might be able to work (Apache Axis2+Rampart/C, for instance), or you can try to shut off some of the incompatible wsHttpBinding features (message security is probably the first). Not to say that it won't work, but you'll probably need some trial-and-error to get it all working right.
上次我检查时,php不支持
wsHttpBinding
The last time I checked, php didn't support
wsHttpBinding