Thanks Eoghan for your inputs.

My requirement is to use addressing in the dynamic client which does not seem to work. I am not sure if this is a limitation of DynamicClientFactory.
I hope CXF ws-addressing feature can interoperate with non-CXF services too.

Appreciate your help.

-Arul

Eoghan Glynn wrote:
Hi Arul,

We'd a vaguely similar requirement in distributed OSGi and here's the approach 
I took ...

1. Spring-load a CXF policy feature wrapping the AddressingPolicy assertion.

<p:policies id="nonDecoupledAddressing" xmlns:p="http://cxf.apache.org/policy";
        
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
        <wsp:PolicyReference URI="#AddressingPolicy"/>
    </p:policies>
    <wsp:Policy wsu:Id="AddressingPolicy"
        xmlns:wsp="http://www.w3.org/ns/ws-policy";
        xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata";>
        <wsam:Addressing>
            <wsp:Policy />
        </wsam:Addressing>
    </wsp:Policy>

I had no particular reason not to use the CXF WSAddressingFeature directly, 
other than to keep it as standardized as possible, as dOSGi is a reference 
implementation of an OSGi spec. Hence the preference for the standard WS-Policy 
assertion as opposed to the CXF-specific feature.


2. Using the simple frontend as opposed to the JAX-WS frontend, I grabbed the 
feature list associated with the ClientProxyFactoryBean via getFeatures() API 
and then simply added the spring-loaded policy feature to the return list, 
before using the factory instance to create a proxy with that feature enabled. 
Et voilĂ , worked a treat.


Obviously the detail of your approach is different, in particular the usage of 
the JAX-WS dynamic client factory as opposed to the equivalent in the simple 
frontend.

Still, the example may be of some help ...

Cheers,
Eoghan.


-----Original Message-----
From: Arul Dhesiaseelan [mailto:[email protected]]
Sent: Thu 05/03/2009 18:54
To: [email protected]
Subject: support for configuring addressing in the dynamic client
Is it possible to add WSAddressingFeature to the Client created from JaxWsDynamicClientFactory?

I tried to do the following, but it failed at runtime due to class cast exception. So, I cannot cast it to a "org.apache.cxf.jaxws.EndpointImpl" which has getFeatures() API. I tried using "org.apache.cxf.endpoint.EndpointImpl" which has an API getActiveFeatures() which returns null when I try to add to the active features list.

    EndpointImpl ep = (EndpointImpl)client.getEndpoint();
    ep.getFeatures().add(new WSAddressingFeature());

Is there any other way to add a feature to the dyna client?

Appreciate any suggestions.

Thanks!
-Arul




Reply via email to