Sorry, message sent too fast :)

Ok I found what I needed.
I simply declared two beans implementing ClientLifeCycleListener and
ServerLifeCycleListener
<bean id="clientListener"
class="fr.edu.rennes.cyclades.pilotage.ws.async.CycladesClientLifeCycleListener"></bean>
<bean id="endpointListener"
class="fr.edu.rennes.cyclades.pilotage.ws.async.CycladesServerLifeCycleListener"></bean>

Now based on the kind of endpoint (if it is a JaxWsEndpointImpl or not), I
can use the AddressingFeatureApplier when I want.

If I'm doing it wrong, please tell me.
Thanks for your help !
Manuel


Le Tue Nov 25 2014 at 11:45:54, Manu <mekt...@gmail.com> a écrit :

> Ok I found what I needed.
> I simply declared two beans implementing
>
>
>
> Le Tue Nov 25 2014 at 11:27:53, Manu <mekt...@gmail.com> a écrit :
>
> Looking at ClientProxyFactoryBean code (method create() ), it seems I can
>> register some kind of listener to be aware of Client creation :
>>             this.getServiceFactory().sendEvent(FactoryBeanListener.
>> Event.PROXY_CREATED,
>>                                                classes, handler, obj);
>>
>> How can I register a listener for that kind of event ?
>> I've looked at the doc (http://cxf.apache.org/docs/bus-configuration.html)
>> but it seems the extension mecanism is not covered ...
>> Any help would be great :)
>> Thanks for your time anyway.
>> Manuel
>>
>>
>>
>> Le Tue Nov 25 2014 at 09:53:34, Manu <mekt...@gmail.com> a écrit :
>>
>> Yes, I know but I want to avoid to configure each service (there is a
>>> hundred services at least), so I was looking for something more centric ;)
>>> I know also I can configure the feature in the bus directly but my bus
>>> contains both SOAP and REST services.
>>> So I was looking for a "hook" in the initialization steps of the client
>>> and server to activate it programmatically ...
>>>
>>>
>>> Le Tue Nov 25 2014 at 09:50:30, Andrei Shakirin <ashaki...@talend.com>
>>> a écrit :
>>>
>>> Hi,
>>>>
>>>> Features are configurable in Spring as well, you can find that in
>>>> samples delivered with CXF distribution:
>>>>
>>>>     <jaxws:endpoint xmlns:customer="http://customerservice.example.com/";
>>>> id="CustomerServiceHTTP" address="http://localhost:9090
>>>> /CustomerServicePort" serviceName="customer:CustomerServiceService"
>>>> endpointName="customer:CustomerServiceEndpoint"
>>>> implementor="com.example.customerservice.server.CustomerServiceImpl">
>>>>         <jaxws:features>
>>>>             <bean class="org.apache.cxf.ws.addressing.
>>>> WSAddressingFeature"/>
>>>>         </jaxws:features>
>>>>     </jaxws:endpoint>
>>>>
>>>> ...
>>>>
>>>>     <jaxws:client id="customerService" address="jms://"
>>>> serviceClass="com.example.customerservice.CustomerService">
>>>>         <jaxws:features>
>>>>             <bean class="org.apache.cxf.ws.addressing.
>>>> WSAddressingFeature"/>
>>>>         </jaxws:features>
>>>>     </jaxws:client>
>>>>
>>>> Regards,
>>>> Andrei.
>>>>
>>>> > -----Original Message-----
>>>> > From: Manu [mailto:mekt...@gmail.com]
>>>> > Sent: Dienstag, 25. November 2014 09:41
>>>> > To: users@cxf.apache.org
>>>> > Subject: Re: Activating WS-Addressing dynamically on selected service
>>>> >
>>>> > Yes I've seen those lines but my services are declared through Spring
>>>> ...
>>>> >
>>>> >
>>>> > Le Tue Nov 25 2014 at 09:26:26, Andrei Shakirin <ashaki...@talend.com>
>>>> a
>>>> > écrit :
>>>> >
>>>> > > Hi,
>>>> > >
>>>> > > I guess I already sent you this peace of code:
>>>> > >
>>>> > > // Option 1
>>>> > > WSAddressingFeature wsa = new WSAddressingFeature(); ...
>>>> > > // Create client or/and server
>>>> > > ...
>>>> > > wsa.initialize(client, client.getBus()); wsa.initialize(server,
>>>> > > server.getBus());
>>>> > >
>>>> > > // Option 2
>>>> > > MyServiceImpl implementor =  new MyServiceImpl() EndpointImpl ep =
>>>> > > (EndpointImpl) Endpoint.create(implementor);
>>>> ep.getFeatures().add(new
>>>> > > WSAddressingFeature()); ep.publish("http://some/address";);
>>>> > >
>>>> > > ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
>>>> > > factory.setServiceClass(MyService.class);
>>>> > > factory.setAddress("http://acme.come/some-service";);
>>>> > > factory.getFeatures().add(new WSAddressingFeature()); MyService
>>>> client
>>>> > > = (MyService) factory.create();
>>>> > >
>>>> > > Please look into http://cxf.apache.org/docs/ws-addressing.html for
>>>> > > further details.
>>>> > >
>>>> > > You can enable it for client and server and then dynamically switch
>>>> on
>>>> > > / switch off the decoupled endpoint through anonymous address.
>>>> > >
>>>> > > Regards,
>>>> > > Andrei.
>>>> > >
>>>> > > > -----Original Message-----
>>>> > > > From: Manu [mailto:mekt...@gmail.com]
>>>> > > > Sent: Montag, 24. November 2014 16:39
>>>> > > > To: users@cxf.apache.org
>>>> > > > Subject: Re: Activating WS-Addressing dynamically on selected
>>>> > > > service
>>>> > > >
>>>> > > > And the way to enable WS-Addressing only for SOAP endpoint with
>>>> > > > something like a feature ? Is there a kind of interceptor for the
>>>> > > > initialization
>>>> > > phase of the
>>>> > > > client and server endpoint ?
>>>> > > >
>>>> > > >
>>>> > > > Le Mon Nov 24 2014 at 16:31:08, Andrei Shakirin
>>>> > > > <ashaki...@talend.com> a écrit :
>>>> > > >
>>>> > > > > Hi,
>>>> > > > >
>>>> > > > > If you just need to deactivate WS-Addressing decoupled endpoint
>>>> > > > > for client call, you can use this code:
>>>> > > > > ((BindingProvider)proxy).getRequestContext()
>>>> > > > >     .put("org.apache.cxf.ws.addressing.replyto",
>>>> AddressingConstants.
>>>> > > > > getAnonymousURI());
>>>> > > > >
>>>> > > > > And activate it again by setting appropriate endpoint address
>>>> into
>>>> > > > > "org.apache.cxf.ws.addressing.replyto".
>>>> > > > >
>>>> > > > > Regards,
>>>> > > > > Andrei.
>>>> > > > >
>>>> > > > > > -----Original Message-----
>>>> > > > > > From: Manu [mailto:mekt...@gmail.com]
>>>> > > > > > Sent: Montag, 24. November 2014 10:59
>>>> > > > > > To: users@cxf.apache.org
>>>> > > > > > Subject: Re: Activating WS-Addressing dynamically on selected
>>>> > > > > > service
>>>> > > > > >
>>>> > > > > > We have two needs :
>>>> > > > > >  - Our CXF bus contains both SOAP services and REST service. I
>>>> > > > > > want to
>>>> > > > > activate
>>>> > > > > > WS-Addressing only on SOAP Services (of course :) )
>>>> > > > > >  - On the other hand, the asynchronous feature of
>>>> WS-Addressing
>>>> > > > > > will not
>>>> > > > > be
>>>> > > > > > activated all the time. We have a context (accessible from a
>>>> > > > > ThreadLocal) that
>>>> > > > > > tell us if we must activate asynchronous execution. BAsed on
>>>> > > > > > this
>>>> > > > > context I was
>>>> > > > > > wondering if I can simply disable WS-Addressing dynamically.
>>>> > > > > > Otherwise I think I found a way by using an interceptor which
>>>> > > > > > sets the
>>>> > > > > ReplyTo
>>>> > > > > > address to "http://www.w3.org/2005/08/addressing/none";, this
>>>> way
>>>> > > > > > the asynchronous execution is disabled.
>>>> > > > > >
>>>> > > > > > Tell me if I'm not clear enough ;) Manuel
>>>> > > > > >
>>>> > > > > >
>>>> > > > > >
>>>> > > > > > On Tue, Nov 18, 2014 at 10:52 PM, Andrei Shakirin
>>>> > > > > > <ashaki...@talend.com>
>>>> > > > > > wrote:
>>>> > > > > >
>>>> > > > > > > Hi,
>>>> > > > > > >
>>>> > > > > > > Could you explain your use case a bit more?
>>>> > > > > > > Are you activating WS-Addressing on the client side
>>>> depending on
>>>> > > > > > > external event?
>>>> > > > > > >
>>>> > > > > > > Basically you can do something like this to activate WSA on
>>>> the
>>>> > > > > > > client
>>>> > > > > > > side:
>>>> > > > > > >         WSAddressingFeature wsa = new WSAddressingFeature();
>>>> > > > > > >         wsa.initialize(client, client.getBus());
>>>> > > > > > >
>>>> > > > > > > If you need to deactivate that you need either to create new
>>>> > > > > > > client instance or remove corresponded interceptors from
>>>> existing
>>>> > > client.
>>>> > > > > > >
>>>> > > > > > > Regards,
>>>> > > > > > > Andrei.
>>>> > > > > > >
>>>> > > > > > > > -----Original Message-----
>>>> > > > > > > > From: Manu [mailto:mekt...@gmail.com]
>>>> > > > > > > > Sent: Montag, 17. November 2014 14:17
>>>> > > > > > > > To: users@cxf.apache.org
>>>> > > > > > > > Subject: Re: Activating WS-Addressing dynamically on
>>>> selected
>>>> > > > > > > > service
>>>> > > > > > > >
>>>> > > > > > > > I looking at adding manually the interceptors.
>>>> > > > > > > > On what should I add thoses interceptors ? On the
>>>> endpoint ? Can
>>>> > > > > > > > I had
>>>> > > > > > > those
>>>> > > > > > > > only for the current exchange ?
>>>> > > > > > > > We want to activate WS-Addressing dynamically based on a
>>>> context
>>>> > > > > > > property (a
>>>> > > > > > > > context we manage).
>>>> > > > > > > > The asynchronous feature needs to be activated only in
>>>> some
>>>> > > > > conditions.
>>>> > > > > > > > How can I do that ?
>>>> > > > > > > > Should I add/remove the interceptors on the endpoint
>>>> based on
>>>> > > > > > > > this
>>>> > > > > > > context ?
>>>> > > > > > > >
>>>> > > > > > > > Regards
>>>> > > > > > > > Manuel
>>>> > > > > > > >
>>>> > > > > > > >
>>>> > > > > > > >
>>>> > > > > > > > On Tue, Nov 11, 2014 at 9:09 AM, Andrei Shakirin
>>>> > > > > > > > <ashaki...@talend.com>
>>>> > > > > > > > wrote:
>>>> > > > > > > >
>>>> > > > > > > > > Hi,
>>>> > > > > > > > >
>>>> > > > > > > > > There are some options to do that:
>>>> > > > > > > > > a) You can add features into client factory:
>>>> > > > > > > > > JaxWsProxyFactoryBean factory = new
>>>> JaxWsProxyFactoryBean();
>>>> > > > > > > > > factory.setAddress("http://acme.come/some-service";);
>>>> > > > > > > > > factory.getFeatures().add(new WSAddressingFeature());
>>>> > > > > > > > > MyService client = (MyService)
>>>> > > > > > > > > factory.create(MyService.class);
>>>> > > > > > > > >
>>>> > > > > > > > > b) You can activate WS-Addressing using policy:
>>>> > > > > > > > > http://cxf.apache.org/docs/ws-addressing.html
>>>> > > > > > > > >
>>>> > > > > > > > > c) You can manually add WS-Addressing interceptors, in
>>>> the
>>>> > > > > > > > > same way as WSAddressingFeature does that.
>>>> > > > > > > > >
>>>> > > > > > > > > Regards,
>>>> > > > > > > > > Andrei.
>>>> > > > > > > > >
>>>> > > > > > > > > > -----Original Message-----
>>>> > > > > > > > > > From: Manu [mailto:mekt...@gmail.com]
>>>> > > > > > > > > > Sent: Montag, 10. November 2014 16:31
>>>> > > > > > > > > > To: users@cxf.apache.org
>>>> > > > > > > > > > Subject: Activating WS-Addressing dynamically on
>>>> selected
>>>> > > > > > > > > > service
>>>> > > > > > > > > >
>>>> > > > > > > > > > Hi,
>>>> > > > > > > > > >
>>>> > > > > > > > > > Is there a way (some class I can extend) to activate
>>>> > > > > > > > > > ws-adressing
>>>> > > > > > > > > dynamically
>>>> > > > > > > > > > without configuring it int the spring configuration
>>>> file.
>>>> > > > > > > > > > We want to be able to activate asynchronous execution
>>>> based
>>>> > > > > > > > > > on some conditions.
>>>> > > > > > > > > >
>>>> > > > > > > > > > I've tried to create a feature and override public
>>>> void
>>>> > > > > > > > > initialize(Client client, Bus
>>>> > > > > > > > > > bus) but this method is not called when creating a
>>>> client ...
>>>> > > > > > > > > >
>>>> > > > > > > > > > Does anyone have an idea ?
>>>> > > > > > > > > > Thanks
>>>> > > > > > > > > > Manuel
>>>> > > > > > > > >
>>>> > > > > > >
>>>> > > > >
>>>> > >
>>>>
>>>

Reply via email to