You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jose María Zaragoza <de...@gmail.com> on 2013/06/04 08:41:49 UTC

Thread-safe JAX-WS client

Hello:

I'm using Apache CXF 2.7.3
and I need to invoke a webservice from a web application ( servlet )

I had thought to implement it with a JAX-WS client , by using Spring's
<jaxws:client>

I would like to know  if I can inject this client into the servlet object
in an object field and , therefore, be shared by all threads using the
servlet instance

Thanks and regards

Re: Thread-safe JAX-WS client

Posted by Daniel Kulp <dk...@apache.org>.
This definitely should be working and we have test cases for it:

https://issues.apache.org/jira/browse/CXF-2449

https://fisheye6.atlassian.com/changelog/cxf?cs=819092


If it's not working, a test case would definitely be useful to see why it's different then the test cases we have.


Dan




On Jun 4, 2013, at 5:00 AM, Jose María Zaragoza <de...@gmail.com> wrote:

> Thanks.
> 
> I guess that when I set <jaxws:client> in CXF Spring context file , I can
> @Autowired it  by type, right ?
> Because , its not working for me
> 
> I've got
> 
> <jaxws:client id="client"
>                   serviceClass="com.ws.FooPortType"
>                   address="http://x.x.x.x/foo/Foo.jpd">
>  </jaxws:client>
> 
> 
> and I try
> 
> @Autowired
> FooPortType client;
> 
> but it is not inyected
> 
> Regards
> 
> 
> 
> 2013/6/4 Freeman Fang <fr...@gmail.com>
> 
>> Hi,
>> 
>> It's thread safe in many cases, please take a look at faq[1] to get more
>> details when it's not thread safe.
>> 
>> [1]http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe
>> -------------
>> 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: @Freeman小屋
>> 
>> www.camelone.org : The open source integration conference:
>> 
>> On 2013-6-4, at 下午2:41, Jose María Zaragoza wrote:
>> 
>>> Hello:
>>> 
>>> I'm using Apache CXF 2.7.3
>>> and I need to invoke a webservice from a web application ( servlet )
>>> 
>>> I had thought to implement it with a JAX-WS client , by using Spring's
>>> <jaxws:client>
>>> 
>>> I would like to know  if I can inject this client into the servlet object
>>> in an object field and , therefore, be shared by all threads using the
>>> servlet instance
>>> 
>>> Thanks and regards
>> 
>> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: Thread-safe JAX-WS client

Posted by Jose María Zaragoza <de...@gmail.com>.
Thanks.

I guess that when I set <jaxws:client> in CXF Spring context file , I can
@Autowired it  by type, right ?
Because , its not working for me

I've got

<jaxws:client id="client"
                   serviceClass="com.ws.FooPortType"
                   address="http://x.x.x.x/foo/Foo.jpd">
  </jaxws:client>


and I try

@Autowired
FooPortType client;

but it is not inyected

Regards



2013/6/4 Freeman Fang <fr...@gmail.com>

> Hi,
>
> It's thread safe in many cases, please take a look at faq[1] to get more
> details when it's not thread safe.
>
> [1]http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe
> -------------
> 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: @Freeman小屋
>
> www.camelone.org : The open source integration conference:
>
> On 2013-6-4, at 下午2:41, Jose María Zaragoza wrote:
>
> > Hello:
> >
> > I'm using Apache CXF 2.7.3
> > and I need to invoke a webservice from a web application ( servlet )
> >
> > I had thought to implement it with a JAX-WS client , by using Spring's
> > <jaxws:client>
> >
> > I would like to know  if I can inject this client into the servlet object
> > in an object field and , therefore, be shared by all threads using the
> > servlet instance
> >
> > Thanks and regards
>
>

Re: Thread-safe JAX-WS client

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

It's thread safe in many cases, please take a look at faq[1] to get more details when it's not thread safe.

[1]http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe
-------------
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: @Freeman小屋

www.camelone.org : The open source integration conference: 

On 2013-6-4, at 下午2:41, Jose María Zaragoza wrote:

> Hello:
> 
> I'm using Apache CXF 2.7.3
> and I need to invoke a webservice from a web application ( servlet )
> 
> I had thought to implement it with a JAX-WS client , by using Spring's
> <jaxws:client>
> 
> I would like to know  if I can inject this client into the servlet object
> in an object field and , therefore, be shared by all threads using the
> servlet instance
> 
> Thanks and regards