You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by XiLai Dai <xl...@talend.com> on 2013/08/07 05:14:58 UTC

How to set a property to Client after it's created from FactoryBean

Hi, there

I got a quick question: how to set a property value to Client after it's already created from an FactoryBean?

ClientFactoryBean clientFactory = new JaxWsClientFactoryBean();
clientFactory. setProperties(...);
Client client = clientFactory.create();

Then, how to add a new property name/value to the client object?

Thanks!
Xilai

RE: How to set a property to Client after it's created from FactoryBean

Posted by XiLai Dai <xl...@talend.com>.
I hit in this way: 
  client.getRequestContext().put(key,value);
  client.getResponseContext().put(key,value);
and it also works well with a custom interceptor.  
Thanks Dan!

Xilai
-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org] 
Sent: Thursday, August 08, 2013 3:46 AM
To: users@cxf.apache.org; XiLai Dai
Subject: Re: How to set a property to Client after it's created from FactoryBean


On Aug 6, 2013, at 11:14 PM, XiLai Dai <xl...@talend.com> wrote:

> Hi, there
> 
> I got a quick question: how to set a property value to Client after it's already created from an FactoryBean?
> 
> ClientFactoryBean clientFactory = new JaxWsClientFactoryBean(); 
> clientFactory. setProperties(...); Client client = 
> clientFactory.create();
> 
> Then, how to add a new property name/value to the client object?

Probably do a client.getEndpoint().put(....)  if you are just trying to set something that can be queries as a contextual property in an interceptor.

Dan




> 
> Thanks!
> Xilai

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


Re: How to set a property to Client after it's created from FactoryBean

Posted by Daniel Kulp <dk...@apache.org>.
On Aug 6, 2013, at 11:14 PM, XiLai Dai <xl...@talend.com> wrote:

> Hi, there
> 
> I got a quick question: how to set a property value to Client after it's already created from an FactoryBean?
> 
> ClientFactoryBean clientFactory = new JaxWsClientFactoryBean();
> clientFactory. setProperties(...);
> Client client = clientFactory.create();
> 
> Then, how to add a new property name/value to the client object?

Probably do a client.getEndpoint().put(….)  if you are just trying to set something that can be queries as a contextual property in an interceptor.

Dan




> 
> Thanks!
> Xilai

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