我必须使用WCF(.net)服务。wsdl中有多个端点,但我不能从中选择BasicHttpBinding。
有PHP客户端支持这个吗?或者我可以在非WSDL模式下以某种方式实现这一点吗?
有一个非常好的PHP SOAP库,可以用来构建基于SAOP的web服务和消费SOAP web服务。
http://nusoap.sourceforge.net/您可以使用WSDL模式,并且仍然可以通过构造函数中的"location"选项和__setLocation()函数来设置位置。您还可以为SoapClient创建一个包装器类,以执行更复杂的操作,例如将所有端点从WSDL中拉出,然后将逻辑应用于它们,以确定使用哪个端点做什么:
class SoapClientCompatibility extends SoapClient{
public function __construct($wsdl, $options){
parent::__construct($wsdl, $options);
//determine which location you want to use here
parent::__setLocation($chosenLocation);
}
public function __doRequest($request, $location, $action, $version){
// --Or, perhaps you want to dynamically switch location in here
}
}