Yes. There are a couple of options:
1) When you create your Service object, the first parameter is the
wsdl URL to use. If you point that to the wsdl (possibly the live "?
wsdl" on the host you want), any proxies (getPort(..)/createPort(...))
stuff created from there will use the URL's in that wsdl.
2) After calling the getPort/createPort, you can override the address
in it by doing:
((BindingProvider)port).getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_URL,
address);
With #2, memory footprint will be less and the startup is quicker as
the wsdl can be cached. Only one wsdl is used and it's just the
address that is overridden. However, you have to make sure that
proxy is synchronized or only used on one thread or something as use
of the RequestContext is not thread safe. (Although in 2.1/2.0.6,
there is a way to make it thread safe at the expense of using more
ThreadLocals internally)
Dan
On May 22, 2008, at 5:31 PM, Chris Dunphy wrote:
Hello,
Is it possible to generate a java service using the CXF wsdl2java
(JAX-WS front end) in such a way that we can use the service with more
than one host?
Basically, I am working on a project where a centralized console
communicates via web services to a number of agents running on remote
hosts.
On the console side I want to be able to use one set of wsdl generated
stub classes and just tell the ServiceImpl class which host to connect
to.
Is this possible?
Thanks,
Chris Dunphy
Software Developer, Enterprise Software Development
Shaw Cablesystems G.P. 750-7417 [EMAIL PROTECTED]
Suite 800 630 3rd Avenue SW, Calgary, Alberta, T2P 4L4
try {
succeed();
} catch (const failed_error& e) {
try {
try_again();
}
}
---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog