Hi Ellen, > But how to decide which operation should apply this policy?
It is your design decision which service operations have to be assumed with the WS-Policies. For example, write operations may be authenticated, this can be unnecessary for read operations of your service. > Can I define it in somewhere? So that I can know the operation:policy > relationship then decide in my interceptor? Such as: > Service1:Operation1:policy1 > Service1:Operation2:policy2 Well, normally this kind of relationship is defined in WSDL directly or using WS-Policy attachments http://www.w3.org/TR/ws-policy-attach/ . If you know at design time which policy are applied to service operations - this is the best way to proceed, because you don't need any own interceptors: CXF will get this definition and apply the policies automatically. But as far as I understood, you would like to decide at runtime which policy have to be applied. In this case you really need to add own interceptor and use PolicyConstants.POLICY_OVERRIDE message property. Could explain your use case a bit more detailed, that I can help you more effectively? Regards, Andrei. > -----Original Message----- > From: ellen [mailto:[email protected]] > Sent: Freitag, 18. Dezember 2015 13:13 > To: [email protected] > Subject: RE: Dynamically set policy via message property > > Thanks a lot Andrei! :) > > BTW, about the question 2: > > You said: > Yes, basically you can determine service operation in your interceptor and > decide (on the base of operation) which parsed policy should be applied. > > But how to decide which operation should apply this policy? > > Can I define it in somewhere? So that I can know the operation:policy > relationship then decide in my interceptor? Such as: > > Service1:Operation1:policy1 > Service1:Operation2:policy2 > > > Thanks a lot! :) > > > > -- > View this message in context: http://cxf.547215.n5.nabble.com/Dynamically- > set-policy-via-message-property-tp5763695p5764163.html > Sent from the cxf-user mailing list archive at Nabble.com.
