Search code examples
phpxmlweb-servicessoapwsdl

How to connect to a remote web service via php using a local WSDL file?


If I want to connect to a third party web service via PHP using a local WSDL file am I right in thinking I should do the following:

$client = new SoapClient("thefile.wsdl", array('location' => "http://anotherdomain.com/soap.asmx"));

If you are using a WSDL file then presumably you can exclude the uri (namespace) variable? And if you don't specify the location here then does it just use the soap:address defined within the services section of the WSDL file?

Thanks!

Dave


Solution

  • The location is (/should be) in the wsdl, so a location in the 2nd argument is not necessary. OTOH, I don't know what happens if you specify another location, you could simply test this, I would guess it ignores it (as locations can also be specified per action, the wsdl should trump it IMO).