Hi Jason,

> I thought I could get in just before the PolicyInInterceptor and check the
> BindingOperationInfo, but that won't be available until the data binding /
> soap action interceptors are executed which is after this interceptor.

Other way to resolve it - explicitly call PolicyInInterceptor again in your 
custom interceptor (configured after data binding interceptors) after preparing 
PolicyConstants.POLICY_OVERRIDE:

public class PolicyControlInInterceptor extends
                AbstractPhaseInterceptor<SoapMessage> {

        public PolicyControlInInterceptor() {
                super(Phase.PRE_PROTOCOL);
                getAfter().add(SAAJInInterceptor.class.getName());
                getBefore().add(WSS4JInInterceptor.class.getName());
                getBefore().add(MustUnderstandInterceptor.class.getName());
        }

        public void handleMessage(SoapMessage message) {
                ...
                message.put(PolicyConstants.POLICY_OVERRIDE, effectivePolicy);
                PolicyInInterceptor.INSTANCE.handleMessage(message);
        }

Regards,
Andrei.


> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of
> Jason Pell
> Sent: Mittwoch, 6. Februar 2013 11:35
> To: [email protected]
> Subject: How can I use the PolicyConstants.POLICY_OVERRIDE to override a
> ws policy for specific operations
> 
> Hi,
> 
> I thought I could get in just before the PolicyInInterceptor and check the
> BindingOperationInfo, but that won't be available until the data binding /
> soap action interceptors are executed which is after this interceptor.
> 
> Is it possible to somehow ignore policies failures in an interceptor based on
> an operation.  For instance I was wondering if I could do something as simple
> as create an interceptor which executes immediately before
> PolicyVerificationInInterceptor.  Check the BindingOperationInfo and if it
> matches an operation name for which we want to ignore policies I remove
> the AssertionInfoMap from the message.  This would cause the
> PolicyVerificationInInterceptor to bail out.
> 
> I am going to give it a try, at first glance it feels like a giant hack, but 
> as I
> cannot get ws policy alternatives to work at an operation level (CXF-4813)
> and I don't really have a lot of time for this, I am thinking this would be a
> viable fallback until the cxf issue is fixed (if it can easily be fixed)
> 
> I want to disable ws policy for the Ping method in my service.

Reply via email to