> -----Original Message----- > From: Dennis Sosnoski [mailto:[email protected]] > Sent: Friday, October 29, 2010 5:56 PM > To: [email protected] > Cc: KARR, DAVID (ATTSI) > Subject: Re: How to change the service URL at runtime? > > 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_PROPE > RTY, > target);
Which article was this from? The search on the devworks site doesn't work very well. Can this stub be cached after this property is set? > 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. > > > >
