Cast the service stub to a binding provider, then set the
ENDPOINT_ADDRESS_PROPERTY in the context to the actual target address.
Here's a sample from my devWorks series:
// create the client stub
CXFLibrary service = new CXFLibrary();
Library stub = service.getLibrary();
// set the actual endpoint address
String target = "http://" + args[0] + ":" + args[1] + args[2];
System.out.println("Connecting to " + target);
BindingProvider provider = (BindingProvider)stub;
provider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
target);
- Dennis
Dennis M. Sosnoski
XML and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
On 10/30/2010 11:54 AM, KARR, DAVID (ATTSI) wrote:
> I've generated classes from my wsdl, but the service URL specified in
> the WSDL is just a placeholder, at least the host:port. I'll need to
> specify a real value for that at runtime. How do I change this at
> runtime? I can't find any mention of this in the docs. The closest I
> can find in the generated code is the "addPort()" method in the
> generated service class. This has a "endpointAddress" parameter. I
> hope I don't have to call this for every port instance.
>
>