Search code examples
javaweb-serviceswsdl

Web service, dynamic address in WSDL address


I'm very new to web services, so sorry if I write a lot of wrong things...

I created a few java classes and generated the wsdl, so I have a bottom-up web service. I deployed everything (in an EAR) and called

  http://localhost:7159/chc2/services/WebServiceManager

to invoke the web service. It works, I obtain the results.

The problem is that I need to deploy the application on other servers, and obviously the first part of the url, the local ip won't be the same.

That url is declared by me in the WSDL with:

<wsdlsoap:address location="http://localhost:7159/chc2/services/WebServiceManager"/>

My question is: there is a way to get the ip part of the link in a dynamic way in the .wsdl? I've found on the net some ways to do it in Java, but I'm directly calling the .wsdl, not passing through java...I guess if there is a way to do that in the .wsdl.

The other configuration files I have are server-config.wsdd and web.xml.

Thank you :)


Solution

  • Some application servers will allow you to submit Web services containing WSDLs with dummy address location:

    <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
    

    Upon deployment, they will replace this value with actual URL! Glassfish supports this feature for sure (actually, I think that you can put whatever you want in address location value, Glassfish will replace it automatically), and according to this link, JBoss also supports this 'feature'. HTH.