Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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

$soapClient->__setLocation('http://www.example.com/soapservice');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top