You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Arul Dhesiaseelan <ar...@fluxcorp.com> on 2009/03/05 19:54:56 UTC

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


Re: support for configuring addressing in the dynamic client

Posted by Daniel Kulp <dk...@apache.org>.
With the DynamicClient, I THINK you can do:

client.getEndpoint().getEndpointInfo() to get the EndpointInfo.

Then add two interceptors:
MAPCodec
MAPAggregator

The MAPAggregator has a addressingRequired flag that is used to force it on 
all the time.     That should put the two interceptors in place to handle this 
properly.   Caveat: I haven't tried it yet.  :-(

Dan



On Thu March 5 2009 6:26:49 pm Arul Dhesiaseelan wrote:
> 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-wssecu
> >rity-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:arul@fluxcorp.com]
> > Sent: Thu 05/03/2009 18:54
> > To: users@cxf.apache.org
> > 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

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: support for configuring addressing in the dynamic client

Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
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:arul@fluxcorp.com]
> Sent: Thu 05/03/2009 18:54
> To: users@cxf.apache.org
> 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
>
>
>
>   


RE: support for configuring addressing in the dynamic client

Posted by Eoghan Glynn <eo...@progress.com>.

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:arul@fluxcorp.com]
Sent: Thu 05/03/2009 18:54
To: users@cxf.apache.org
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