简体   繁体   English

通过wsHttpBinding在PHP中调用WCF WebService

[英]Calling a WCF WebService in PHP via wsHttpBinding

I have a WCF webservice I can connect to it via basicHttp, but not wsHttp. 我有一个WCF web服务,我可以通过basicHttp连接到它,但不是wsHttp。 I try to conenct to it via wshttp via the following: 我尝试通过以下方式通过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
     )
);

The call to the SoapClient constructor returns fine. 对SoapClient构造函数的调用返回正常。 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". 当我尝试使用$ client-> FunctionName调用一个时,页面只是在那里加载了很长一段时间,并最终返回错误“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.) (从.Net客户端使用该服务非常有效。)

The default config on wsHttpBinding uses advanced WS-Security and WS-Addressing features that aren't understood by the vanilla PHP SoapClient. wsHttpBinding上的默认配置使用了vanilla PHP SoapClient无法理解的高级WS-Security和WS-Addressing功能。 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). 还有其他PHP可访问的SOAP客户端可能能够工作(例如Apache Axis2 + Rampart / C),或者您可以尝试关闭一些不兼容的wsHttpBinding功能(消息安全性可能是第一个)。 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM