cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrei Shakirin <ashaki...@talend.com>
Subject RE: Dynamically set policy via message property
Date Tue, 22 Dec 2015 17:17:10 GMT
Hi Ellen,

> But you know, without WSDL file, I can only define policy by using
> POLICY_OVERRIDE, but I don't know where to define the WS-Policy
> attachments relationship between policy and operation.

This isn't completely correct. In Java first approach you still can define WS-Polices using
@Policies and @Policy annotations in your java code.
See system test for details:
 https://github.com/apache/cxf/blob/master/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyService.java

https://github.com/apache/cxf/blob/master/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/policy/JavaFirstPolicyServiceTest.java

I would recommend to use this approach in your case.

POLICY_OVERRIDE makes sense only, if polices must be composed or updated dynamically when
Service operation is invoked.

Regards,
Andrei.

> -----Original Message-----
> From: ellen [mailto:ellenxiao0220@163.com]
> Sent: Montag, 21. Dezember 2015 14:51
> To: users@cxf.apache.org
> Subject: RE: Dynamically set policy via message property
> 
> Thanks a lot Andrei! :)
> 
> This is about a requirement from our end user.
> 
> User defines their web service provider without using WSDL (also doesn't
> use Spring), they just use @WebService annotation to define service, so they
> cannot get WSDL file and cannot add any policy in the WSDL file.
> 
> But they also want to use Policy such as WS-Security for their application.
> 
> And define some policy on operation level.
> 
> I have know know to define and add a policy by using POLICY_OVERRIDE, like
> this:
> https://github.com/ashakirin/cxf.howtos/blob/master/ws-
> policy.dynamic/src/main/java/com/example/customerservice/interceptors/
> DynamicPolicyInInterceptor.java
> 
> But you know, without WSDL file, I can only define policy by using
> POLICY_OVERRIDE, but I don't know where to define the WS-Policy
> attachments relationship between policy and operation.
> 
> So you know I want to decide at runtime. :)
> 
> I have a solution: create a new file(such as named attachment.xml) and
> define the policy and operation/service relationship, like this:
> wspolicy1|service1:operation1
> wspolicy2|service2:operation1
> 
> Then I read this relationship and check in my DynamicPolicyInInterceptor if
> this operation need to bind the policy or not.
> 
> 
> So I would like to know if this is my right way to do that? or CXF has a better
> way?
> 
> Thanks a lot! :)
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Dynamically-
> set-policy-via-message-property-tp5763695p5764182.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Mime
View raw message