Classification: UNCLASSIFIED
Caveats: NONE
>
> >
> > > For case 3, will afterInvoke will be called with the response
> > > MessageContext that contains the response SOAP message? If so, I
> > would
> > > like your proposed workaround/fix for case 3 to be included if
> > possible.
> > > It'll give us a compatible Fault handling with other services
> > > (non-Tuscany). It'll also enable auditing when Fault occurs.
> > >
> > That depends on how Axis2 behaves when it throws an Axisfault from
> > operationClient.execute(). Tuscany could do the following after it
> > catches AxisFault, as it does in the non-AxisFault case:
> >
> > MessageContext responseMC =
> >
>
operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE)
> > ;
> > for ( PolicyHandler policyHandler : policyHandlerList ) {
> > policyHandler.afterInvoke(msg, responseMC, operationClient);
> > }
> >
> > This will do what you want if Axis2 puts the response SOAP message
in
> > the response MessageContext before it throws the AxisFault. It
won't
> > do what you want if Axis2 just throws the AxisFault and doesn't set
> up
> > the response MessageContext.
> >
>
> Maybe I should take a look at the context in the debugger before we do
> anything.
>
Hi, Simon,
I did try what you described here and it worked - afterInvoke is called
with respnseMC that contains the fault SOAP message. So it's doable.
Here's the code snippet.
try {
AccessController.doPrivileged(new
PrivilegedExceptionAction<Object>() {
public Object run() throws AxisFault {
operationClient.execute(true);
return null;
}
});
} catch (PrivilegedActionException e) {
MessageContext responseMC =
operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
for ( PolicyHandler policyHandler : policyHandlerList )
{
policyHandler.afterInvoke(msg, responseMC,
operationClient);
}
operationClient.complete(requestMC);
throw (AxisFault)e.getException();
}
Thanks,
Gang
Classification: UNCLASSIFIED
Caveats: NONE