Why does the web service return data even if the IP address in the wsdl is wrong?

There is a file PHP

acting like webservice

and there is a file wsdl

that has the following 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 wsdl

is located is 192.168.1.123 and I am getting the data when I call the function from the web service PHP

! So no tag <soap:address

needed?

+3


source to share


1 answer


The short answer is . The address is just an indication (for developers or tools that generate code and configuration) where the service can be accessed and what URL to expect.

Long Answer: If you look at the WSDL schema , you can see that the element port

is defined as containing only an attribute name

and binding

so that should be enough. Your migh service element looks like this, and it is technically correct:

<service name="ClientService">
   <port name="ClientPort" binding="typens:ClientBinding" />
</service>

      

But it is port

also defined as an extensible element that allows elements from other namespaces (for example <soap:address>

) to be added to it .



Usually (yes!) <soap:address>

Should indicate where the real service is located, but unfortunately this does not always happen due to various factors, such as:

  • some server addresses were changed and people forgot to update the WSDL file (for the contract first created the WSDL);
  • The WSDL is automatically generated by the framework (the contract is the last one ) and the framework has no way of knowing which external address the web service is displayed on, so it adds some default address with something it knows (like local IP or machine name );
  • you have a central WSDL that describes 3 identical services deployed (one in DEV, one in UAT and one in PROD) and you cannot add an address for all 3 of them;
  • etc.

WSDLs are mainly used to generate client code. After that, you don't need the WSDL anymore, you just need a URL where you can connect to your deployed web service. The address is there as a hint for the tools to add some default configuration, which you will later replace with the REAL address for calls.

Ideally, something in the WSDL should equal the real address, but that some information that usually ends up in maintenance tasks and things end up being outdated. You must specify it as a prompt, even if its simple <soap:address location="http://localhost/imfmobile/webservice/InterfaceTransfererClient.php"/>

.

+4


source







All Articles