Sorry I am asking the same question twice.
I deployed the JAX-WS web service, and consume it from my client code.
My requirement is,
how should I avoid building my client code (stubs) while relocating my JAX-WS web service from one place to another?
Thank you.
If you are using Spring, you can create a helper bean for configuring your client (which is what I’ve done on a recent project):
The parts between the ${…} are property placeholders, which means that the value is looked up from a properties file, which is specified by a PropertyPlaceholderConfigurer. An example of specifying the value looks as follows:
You can then modify the properties file (maybe ‘myapplication.properties’) to change the WSDL location as needed (even at runtime if you use a custom TargetSource with a ProxyFactoryBean) For what it’s worth, here is my implementation of a simple JaxWsClientFactoryBean (no automatic property modification support):
I decided to offer an answer, even though you’ve already answered your own question. Maybe you will find this advice useful. The good thing about using a FactoryBean-like implementation is that it can be reused for all of your web service clients and encapsulates the creation of the web services from their consumers. Your web tier or business tier objects will only depend on the SEI (service endpoint interface).