Is there any SOAP client library in PHP which can handle WSDL with multiple endpoints?
I have to consume WCF(.net) service. There are multiple endpoints in the wsdl, but I can not choose BasicHttpBinding from them.
Is there 开发者_StackOverflow中文版any PHP client which support this? Or can I achive this in some way in non WSDL mode?
There is very good PHP SOAP library which can be used for building SAOP based web services and consuming SOAP web services too..
http://nusoap.sourceforge.net/
You can use WSDL mode, and still set a location, both with the "location" option on the constructor, and through use of the __setLocation() function. You could also make a wrapper class for the SoapClient to do more sophisticated things like pulling all the endpoints out of the WSDL, and then applying logic to them to determine which endpoint to use for what:
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
}
}
精彩评论