cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Sosnoski <...@sosnoski.com>
Subject Re: How to change the service URL at runtime?
Date Sat, 30 Oct 2010 06:29:08 GMT
Ah - actually, it looks like I just used this in the example code for my
CXF article without discussing it in the article.  :-[   It's standard
JAX-WS coding.

The article is the one at
http://www.ibm.com/developerworks/java/library/j-jws12.html

And yes, you can just cache the stub with the property set.

  - Dennis


On 10/30/2010 04:20 PM, KARR, DAVID (ATTSI) wrote:
>> -----Original Message-----
>> From: Dennis Sosnoski [mailto:dms@sosnoski.com]
>> Sent: Friday, October 29, 2010 5:56 PM
>> To: users@cxf.apache.org
>> 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.
>>>
>>>
>>>       
>   

Mime
View raw message