Classification: UNCLASSIFIED
Caveats: NONE


Hi, Simon and others,

 

I'm reposting this because I found my earlier post was grouped under an
old topic and it may be why I did not receive any response, which I
badly hope to hear. To provide a background, I'm trying to write a
Policy extension to add a new WS-security implementation to WS binding
in Tuscany. In my earlier post (see
http://www.mail-archive.com/[email protected]/msg15333.html), I
described the problems with Tuscany 1.6.x Policy extension framework
using PolicyInterceptor approach and got some pointers from Simon, one
is to try Tuscany 2.0 and the other is to use the PolicyHandler
extension in Tuscany 1.6.x.

 

I did not get any response for my request for help on the 2.0 Policy

issues (see
http://www.mail-archive.com/[email protected]/msg15353.html), so I
went ahead down to

the second path Simon suggested - to work with PolicyHandler extension

point in 1.6.x.

 

Everything went well on the reference side until I was testing on the

service side. I think the current PolicyHandler extension framework has

a defect when processing the PolicyHandler.afterInvoke() call for the
service side and the model does not fit the need to add WS-security to
the binding.ws.axis2 binding implementation. Today
PolicyHandler.afterInvoke() is call with the OMElement response and
MessageContext inMC, which is still the message context for the inbound
request. In order to add WS-security to the response, I need to access
the message context for the outbound response.

 

So I modified Axis2ServiceInOutSyncMessageReceiver and

Axis2ServiceProvider classes to delay the calling of
PolicyHandler.afterInvoke()

from inside Axis2ServiceProvider.invokeTarget() before outMC is
constructed to after outMC has been constructed in
Axis2ServiceInOutSyncMessageReceiver.invokeBusinessLogic(). After the
change, my prototype worked and it also passed all unit tests.

 

Now I would like to hear Tuscany developers' opinions and/or get your
blessing. If this change is fine, how can it be pulled back into the
code base? If not, what can be done to support what I would like to do,
which is pretty natural and generic.

 

I would really appreciate responses so our project can make a decision.

 

Thanks in advance,

Gang

 

PS:

The following is the code segments to high light the change I made (with
"Gang: ..." comments):

 

Axis2ServiceInOutSyncMessageReceiver.invokeBusinessLogic(...) {

                ....

            OMElement responseOM =
(OMElement)provider.invokeTarget(operation, args, inMC);

            

            /*

            for ( PolicyHandler policyHandler : policyHandlerList ) {

                policyHandler.afterInvoke(operation, args, inMC,
responseOM);

            }

            */

 

            SOAPEnvelope soapEnvelope =
getSOAPFactory(inMC).getDefaultEnvelope();

            if (null != responseOM ) {

                soapEnvelope.getBody().addChild(responseOM);

            }

            outMC.setEnvelope(soapEnvelope);

 
outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN,
Constants.VALUE_TRUE);

                

            // Gang: Added

            for ( PolicyHandler policyHandler : policyHandlerList ) {

                policyHandler.afterInvoke(responseOM, outMC);

            }

                ...

}

 

Axis2ServiceProvider.invokeTarget(...) {

          ...

        // find the runtime wire and invoke it with the message

        RuntimeWire wire =
((RuntimeComponentService)contract).getRuntimeWire(getBinding());

        Object response =  wire.invoke(op, msg);

        

        // Gang: Commented out

        // for ( PolicyHandler policyHandler : policyHandlerList ) {

        //    policyHandler.afterInvoke(response, inMC);

        //}        

        

        return response;

}

 

 

 

 


Classification: UNCLASSIFIED
Caveats: NONE


Reply via email to