Following up on Gang's thread about policy handling in 1.x and getting
the right effect when trying to apply security policy with the Web
Services binding I'm looking at how policy is applied in 2.x. I've
created a test case [1] which has three components with the same
implementation:

    <component name="HelloworldComponent1">
        <implementation.java class="sample.HelloworldImpl"/>
        <reference name="hwRef"
                   target="HelloworldComponent2"
                   requires="tuscany:interaction.bindingws"
                   policySets="tuscany:InteractionBindingWS"/>
        <property name="componentName" value="HelloworldComponent1"/>
    </component>

     <component name="HelloworldComponent2">
        <implementation.java class="sample.HelloworldImpl"/>
        <service name="Helloworld"
                 requires="tuscany:interaction.bindingws"
                 policySets="tuscany:InteractionBindingWS">
            <binding.ws/>
        </service>
        <reference name="hwRef" target="HelloworldComponent3"/>
        <property name="componentName" value="HelloworldComponent2"/>
    </component>

    <component name="HelloworldComponent3">
        <implementation.java class="sample.HelloworldImpl"/>
        <property name="componentName" value="HelloworldComponent3"/>
    </component>

I've added three components so I can look at the context propagation
issue across the central component but for now I'm looking at how
policy interceptors are applied in relation to the WS binding used
between HelloworldComponent1 and HelloworldComponent2. To facilitate
this you can see that I've added an interaction policy that has parts
with are specific to binding ws. It's intended to demonstrate adding

A generic policy interceptor in the Tuscany operation chain
A binding specific policy interceptor in the Tuscany binding chain
An Axis handler added by the policy

This test policy isn't configurable and the providers are hard coded
to add the appropriate handlers [2] [3]. The result is the following
sequence for the forward an response message passing between the two
components.

TestPolicyInterceptor.processRequest()
HelloworldComponent1#reference-binding(hwRef/Helloworld) @
reference.policy
TestPolicyInterceptor.processRequest()
HelloworldComponent1#reference-binding(hwRef/Helloworld) @
reference.binding.policy
TestAxisHandler.invoke() Reference OutFlow Handler
TestAxisHandler.invoke() Service InFlow Handler
TestPolicyInterceptor.processRequest()
HelloworldComponent2#service-binding(Helloworld/Helloworld) @
service.binding.policy
TestPolicyInterceptor.processRequest()
HelloworldComponent2#service-binding(Helloworld/Helloworld) @
service.policy
TestPolicyInterceptor.processResponse()
HelloworldComponent2#service-binding(Helloworld/Helloworld) @
service.policy
TestPolicyInterceptor.processResponse()
HelloworldComponent2#service-binding(Helloworld/Helloworld) @
service.binding.policy
TestAxisHandler.invoke() Service OutFlow Handler
TestAxisHandler.invoke() Reference InFlow Handler
TestPolicyInterceptor.processResponse()
HelloworldComponent1#reference-binding(hwRef/Helloworld) @
reference.binding.policy
TestPolicyInterceptor.processResponse()
HelloworldComponent1#reference-binding(hwRef/Helloworld) @
reference.policy

Which looks OK on the face of it but looking in detail I find that the
service side binding interceptor is happening outside the context of
the Axis binding. So I'm going to look at fixing that first. Then I'll
look at each of the issues that Gang raised and see if/how this
infrastructure provides a solution.

[1]  
http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/
[2] 
http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSReferencePolicyProvider.java
[3] 
http://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSServicePolicyProvider.java

Regards

Simon

-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to