Search code examples
wsdljax-wscxfwsdl2java

How does CXF translate WSDL's localhost to actual server URL?


All WSDLs I have seen so far, use localhost to describe the services address. e.g.:

<wsdl:service name="SQLService">
  <wsdl:port name="SQLServiceSoap" binding="tns:SQLServiceSoap">
     <soap:address location="http://localhost:8080/rservice/services/SQLServiceSoap" />
  </wsdl:port>
</wsdl:service>

But when the client of such service is run, it somehow knows where the real URL of that service, even if run on a remote machine!

How does CXF perform this "magic"?

IOW, how does the client JAR on a test machine which is not the machine on which the service runs, know where that server is and its address?

I grep-ed the source code and strings-ed the client's jar file and found no trace whatsoever to the server's URL.

So how does that work?

UPDATE: In my super natural detective efforts, I just found a file named config.xml in the directory where the client's JAR file is located. That config.xml contains the actual server's URL. So it appears that this is how this is done in the particular case of the project I inherited.

Now the question(s) is:

  1. Is this the standard way of doing this?
  2. Is there a standard (or recommended way) at all in CXF?
  3. Or is it pretty much left to the developer to decide?

Solution

  • In many cases, the web service will have a production URL and a test/QA/UAT URL. The developer will develop against the test URL, and then once it's ready for production he will switch the URL to point to production.

    It is up to the developer to decide how this is accomplished and there is no standard way of handling it.