You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Hervé BARRAULT <he...@gmail.com> on 2012/10/19 13:27:41 UTC

Apache CXF Client for Dynamic Endpoints

Hi,
i'm using CXF to create a client like this :

final ExampleService service = new ExampleService();
client = service.getExamplePort();

Now, i would use a dynamic endpoint (don't call each time the same url).

I have seen the following method (which is working):
((BindingProvider)
client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
myUrl);

Now i call my client like this :

public Object myFirstMethod(final String myUrl, final MyExampleParam
object) {
     ((BindingProvider)
client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
myUrl);
     return client.myFirstMethod(object);
}

As I can have concurrent calls to this method, should I synchronize it ? (I
have not yet noticed strange behavior, but I guess it is compulsory)

Is there some possible problems when using https instead of http with this
mechanism ?

Thanks for answers
Regards

Re: Apache CXF Client for Dynamic Endpoints

Posted by Hervé BARRAULT <he...@gmail.com>.
Thank you, sorry I hadn't noticed that the FAQ answer my question
Regards.


On Mon, Oct 22, 2012 at 4:49 AM, Freeman Fang <fr...@gmail.com>wrote:

> Hi,
>
> Take a look at our FAQ here[1], yeah, you need synchronize it.
>
> And no, there's no real difference between http and https
>
> [1]http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F
> -------------
> Freeman(Yue) Fang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
>
> On 2012-10-19, at 下午7:27, Hervé BARRAULT wrote:
>
> > Hi,
> > i'm using CXF to create a client like this :
> >
> > final ExampleService service = new ExampleService();
> > client = service.getExamplePort();
> >
> > Now, i would use a dynamic endpoint (don't call each time the same url).
> >
> > I have seen the following method (which is working):
> > ((BindingProvider)
> >
> client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
> > myUrl);
> >
> > Now i call my client like this :
> >
> > public Object myFirstMethod(final String myUrl, final MyExampleParam
> > object) {
> >     ((BindingProvider)
> >
> client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
> > myUrl);
> >     return client.myFirstMethod(object);
> > }
> >
> > As I can have concurrent calls to this method, should I synchronize it ?
> (I
> > have not yet noticed strange behavior, but I guess it is compulsory)
> >
> > Is there some possible problems when using https instead of http with
> this
> > mechanism ?
> >
> > Thanks for answers
> > Regards
>
>

Re: Apache CXF Client for Dynamic Endpoints

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Take a look at our FAQ here[1], yeah, you need synchronize it. 

And no, there's no real difference between http and https

[1]http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-10-19, at 下午7:27, Hervé BARRAULT wrote:

> Hi,
> i'm using CXF to create a client like this :
> 
> final ExampleService service = new ExampleService();
> client = service.getExamplePort();
> 
> Now, i would use a dynamic endpoint (don't call each time the same url).
> 
> I have seen the following method (which is working):
> ((BindingProvider)
> client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
> myUrl);
> 
> Now i call my client like this :
> 
> public Object myFirstMethod(final String myUrl, final MyExampleParam
> object) {
>     ((BindingProvider)
> client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
> myUrl);
>     return client.myFirstMethod(object);
> }
> 
> As I can have concurrent calls to this method, should I synchronize it ? (I
> have not yet noticed strange behavior, but I guess it is compulsory)
> 
> Is there some possible problems when using https instead of http with this
> mechanism ?
> 
> Thanks for answers
> Regards