XML & Web services: Dynamic Endpoint in WSDL
I have developed a Web Services in RAD 6 in my local machine. SO the WSDL shows http://localhost:9080/XYZ as the default URL inside it. But once I deploy it to my server which has a different ip and port the same http://localhost:9080 remains. Can any one suggest how to make my WSDL dynamic so that it picks up the appropiate URL where every it gets deployed? Thanks in advance. Sabya
- Posted by: Sabyasachi Chowdhury
- Posted on: July 27 2007 23:29 EDT
In the past, I use an ant (or could be maven) config script to populate the endpoint URL when you build the target ear/war for deployment. This is pretty easy to do, but prevents you from creating a generic war. A better solution (although a bit more complex) would be to map *.wsdl to a particular servlet (or whatever you want to use) to populate endpoints dynamically. This becomes important in enterprise scenarios as the endpoint may need to change as resources shift. By default, you could replace localhost with whatever your deployment server + app name is, but in the long run could read from a configuration source.