Hi Ellen,

Regarding 4: 
take a look into 
http://ashakirin.blogspot.de/2012/02/using-ws-policy-in-cxf-projects.html .
For code example you can take any assertion in CXF and see how it implemented: 
https://github.com/apache/cxf/tree/master/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy

Regards,
Andrei.

> -----Original Message-----
> From: ellen [mailto:[email protected]]
> Sent: Donnerstag, 18. Juni 2015 16:46
> To: [email protected]
> Subject: How can cxf know and get custom ws-policy?
> 
> Hi all,
> 
> I would like to use a new custom ws-policy, and would like to let cxf know and
> check it, I see there is a link about that, but there is no E2E code so that 
> my
> development is not work for me, could you please help me double check which
> step is wrong? Appreciate it! :) http://cxf.apache.org/docs/developing-
> assertions.html
> 
> My custom policy like this:
> <wsat:ATAssertion wsp:optional="true" />
> 
> </wsp:Policy>
> 
> Question 1:
> Need I develop AssertionBuilder and Policy-Aware Interceptor to know this
> custom policy?
> 
> Or I just need write an interceptor before PolicyInInterceptor, and then
> run:
>  public void handleMessage(Message message) {
> 
>       // get AssertionInfoMap
>        org.apache.cxf.ws.policy.AssertionInfoMap aim =
>            message.get(org.apache.cxf.ws.policy.AssertionInfoMap.class);
>        Collection<AssertionInfo ais> = aim.get(assertionType );
> 
>        // extract Assertion information
>        for (AssertionInfo ai : ais) {
>            org.apache.neethi.Assertion a = ai.getAssertion();
>            MyAssertionType ma = (MyAssertionType)a;
>           // digest ....
>        }
> 
>        // process message ...
>             // express support
> 
>        for (AssertionInfo ai : ais) {
>            ai.setAsserted(...);
>        }          }
> }
> To set assertion?
> 
> 
> Question 2:
> If question 1 is not, I need complete full flow of policy development, what's 
> the
> correct step?
> 
> 1, Implementing the AssertionBuilder, complete build and getKnownElements
> method, and return my Assertion object in build method.
> 
> 2, Implement Policy-Aware Interceptor and MyInterceptorProvider, in the
> interceptor, what I should do is:
> // get AssertionInfoMap
>        org.apache.cxf.ws.policy.AssertionInfoMap aim =
>            message.get(org.apache.cxf.ws.policy.AssertionInfoMap.class);
>        Collection<AssertionInfo ais> = aim.get(assertionType );
> 
>        // extract Assertion information
>        for (AssertionInfo ai : ais) {
>            org.apache.neethi.Assertion a = ai.getAssertion();
>            MyAssertionType ma = (MyAssertionType)a;
>           // digest ....
>        }
> 
>        // process message ...
>             // express support
> 
>        for (AssertionInfo ai : ais) {
>            ai.setAsserted(...);
>        }          }
> to set Assertion?
> 
> 
> And in MyInterceptorProvider is add these interceptor?
>  public MyInterceptorProvider() {
>         super(ASSERTION_TYPES);
>         getInInterceptors().add(IN_INTERCEPTOR);
>         getOutInterceptors().add(OUT_INTERCEPTOR);
>         getOutFaultInterceptors().add(OUT_FAULT_INTERCEPTOR);
>     }
> But where to add them? before PolicyInInterceptor and PolicyOutInterceptor?
> 
> Then add these in META-INF/cxf/bus-extensions.txt
> org.company.MyInterceptorProvider::true
> org.company.MyAssertionBuilder::true
> 
> 
> Question 3:
> If I implement AssertionBuilder and Policy-Aware Interceptor, Need I
> implement a Policy-Aware Conduit/Destination?
> 
> 
> Question 4:
> 
> Do you have a full E2E document or link, so  that I can deeply study?
> I cannot search detail article in Google....
> 
> Great thanks a lot!
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/How-can-cxf-
> know-and-get-custom-ws-policy-tp5758385.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to