문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

$soapClient->__setLocation('http://www.example.com/soapservice');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top