I think this is now fixed with 2.5.1-SNAPSHOT (final testing before doing 
release right now).       I also assume you are using Spring and not blueprint 
with that config.

I spent a ton of time last week trying to rationalize some of the lifecycle 
stuff and parsing things and some of what you are describing falls into the 
issues I was seeing last week and tried to fix.   There were all kinds of 
issues with server/client lifecycle events firing before the bus events, 
features/interceptors overwriting each other, etc...    What's worse, the 
behavior was quit different for Spring and Blueprint.   2.5.1 brings things 
more inline with each other and hopefully fixes a bunch of this.

Dan



On Thursday, December 15, 2011 11:04:42 AM Andrei Shakirin wrote:
> Hi,
> 
> I faced one effect by using policies:
> 
> WS-Addressing Policy feature is configured in client spring configuration:
> 
> <jaxws:client id="FlightReservationClient"
>             
> xmlns:serviceNamespace="http://www.eclipse.org/swordfish/samples/FlightRese
> rvation"
> serviceClass="org.eclipse.swordfish.samples.flightreservation.FlightReserva
> tion" serviceName="serviceNamespace:FlightReservationService"
> endpointName="serviceNamespace:FlightReservationSOAP"
> address="http://localhost:9040/services/FlightReservationService";>
> 
>              <jaxws:features>
>                     <bean
>                           
> class="org.talend.ps.rudi.resolver.serviceregistry.ServiceRegistryFeature"
> /> <policy:policies>
>                            <wsp:Policy
> xmlns:wsp="http://www.w3.org/ns/ws-policy";> <wsam:Addressing
> xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata"; /> </wsp:Policy>
>                     </policy:policies>
>              </jaxws:features>
>        </jaxws:client>
> 
> In the same file custom out interceptor is configured:
>        <cxf:bus>
>              <cxf:outInterceptors>
>                     <ref bean="AgreedPolicyInterceptor" />
>              </cxf:outInterceptors>
>        </cxf:bus>
> 
> As far as PolicyFeature is defined in client configuration, PolicyEngineImpl
> adds some interceptors into  chain:
> bus.getInInterceptors().add(PolicyInInterceptor.INSTANCE);
> bus.getOutInterceptors().add(PolicyOutInterceptor.INSTANCE);
> bus.getInFaultInterceptors().add(ClientPolicyInFaultInterceptor.INSTANCE);
> bus.getOutFaultInterceptors().add(ServerPolicyOutFaultInterceptor.INSTANCE)
> ;
> bus.getInFaultInterceptors().add(PolicyVerificationInFaultInterceptor.INSTA
> NCE);
> 
> Effect is following: as far as I define custom interceptor in client
> configuration, it overrides Policy interceptors added by PolicyEngineImpl.
> After it policy doesn't work anymore. As soon as comment my custom out
> interceptor - policy works.
> Policy also works if custom interceptor is configured not in cxf:bus, but in
> jaxws:outInterceptors inside the client.
> 
> Overriding happens in method
> org.apache.cxf.interceptor.AbstractBasicInterceptorProvider.setOutIntercept
> ors(): public void setOutInterceptors(List<Interceptor<? extends Message>>
> interceptors) { out = interceptors;
>     }
> 
> It doesn't adds configured interceptors to existing, but just replaces them.
> The same is true for in and fault interceptors.
> 
> The question is it work as designed?
> 
> Regards,
> Andrei.
-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to