0

I'm using PHP's builtin SoapServer class to implement a Web service. I need to set the location attribute in the following segment of the WSDL code:

<wsdl:service name="serviceName">
  <wsdl:port name="serviceNameSoap" binding="tns:serviceNameSoap">
    <soap:address location="MY_URL_HERE" />
  </wsdl:port>
  <wsdl:port name="serviceNameSoap12" binding="tns:serviceNameSoap12">
    <soap12:address location="MY_URL_HERE" />
  </wsdl:port>
</wsdl:service>

What is the best way to do this programmatically?

Jay Bienvenu
  • 3,069
  • 5
  • 33
  • 44

2 Answers2

0

If the location can change then save it somewhere in a configuration file or database and do a

str_replace('MY_URL_HERE', 'http://localhost/service') 

on the WSDL file before you return it.

Tom
  • 874
  • 7
  • 13
0

Another way is to override the location of our web service from client side, for example:

$soapClient->__setLocation('http://www.example.com/soapservice');
Christin Gruber
  • 540
  • 4
  • 7