There is a PHP
file acting as a webservice
, and there is the wsdl
file in which there is these lines :
<service name="ClientService">
<documentation></documentation>
<!-- partie 8 : Port -->
<port name="ClientPort" binding="typens:ClientBinding">
<soap:address location="http://192.168.1.12/imfmobile/webservice/InterfaceTransfererClient.php"/>
</port>
</service>
The problem is that the IP address of the computer where the webservice
and the wsdl
reside is 192.168.1.123 , and I get data when calling a function from the PHP
webservice ! So is the <soap:address
tag not necessary ?
Short answer: The address is just an indication (for developers or tools that generate code and configuration) of where the service might be accessible and what kind of URL to expect.
Long answer: If you look at the WSDL schema, you will see that the port
element is defined as containing only a name
and binding
attribute, so that will be enough. Your service element migh look like this and it will be technically correct:
<service name="ClientService">
<port name="ClientPort" binding="typens:ClientBinding" />
</service>
But port
is also defined as an extensible element which allows elements from other namespaces to be added to it (like <soap:address>
).
Normally (yes!) the <soap:address>
should state where the real service is exposed, but unfortunately it doesn't always happen like that because of different factors like:
WSDLs are mainly used to generate client code. Once that's done you don't need the WSDL anymore, you just need an URL where to connect to the deployed web service. The address is there as a hint for tools to add some default configuration, which you later replace with the REAL address for the calls.
Ideally what's in the WSDL should be equal to the real address, but that's some info that usually falls through maintenance tasks and things end up getting outdated. You should specify one as a hint, even if its just <soap:address location="http://localhost/imfmobile/webservice/InterfaceTransfererClient.php"/>
.