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:
- some server addresses were changed and people forgot to update the WSDL file (for contract first created WSDLs);
- the WSDL is automatically generated by a framework (contract last) and the framework has no way of knowing at what external address the web service is exposed so it adds some default address with something it knows (like the local IP or the machine name);
- you have a central WSDL that describes 3 identical deployed services (one in DEV, one in UAT and one in PROD) and you can't add an address for all 3 of them;
- etc etc
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"/>
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…