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/FlightReservation"
serviceClass="org.eclipse.swordfish.samples.flightreservation.FlightReservation"
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.INSTANCE);
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.setOutInterceptors():
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.