axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shantanu Sen <s...@pacbell.net>
Subject Client Handler bug?
Date Sat, 14 Aug 2004 17:41:28 GMT
I tried to use client side JAX-RPC handlers and saw
the following problem.

I had 2 handlers handler1 and handler 2. If I use the
happy path everything is fine - handler1.handleRequest
is first called and then handler2.handleRequest and
then the corresponding handleResponse methods in
reverse order after invoking the end-point.

However, if I return false in one of the handleRequest
methods, the call still goes through to the service
i.e. the happy path is pursued regardless of the fact
that the client handler request method returned false
signaling the runtime to stop processing.

If I throw a SOAPFaultException or JAXRPCException
from the <handler1/2>handleRequest, the call does not
go through, but I do not see the handleFault methods
called at all.

Is this a known issue? A search on JIRA did not fetch
any bugs related to client side JAX-RPC handlers. 

Looking at the code I see that the AxisClient has no
provisions for handling fault/exception after calling
the JAX-RPC handlers. Here is the code snippet from
AxisClient.invokeJAXRPCHandlers from the latest CVS
tree. 

---------
HandlerChainImpl impl = (HandlerChainImpl)
hiChainFactory.createHandlerChain();

if(!context.getPastPivot()) {
  impl.handleRequest(context);
}else {
  impl.handleResponse(context);
}
impl.destroy();
-----------

What happens if the impl.handleRequest() call returns
false? No action is taken.

On the other hand, for server side JAX-RPC handlers,
when I see the calls from SOAPService, it is indeed
taking care of the false return (I am not sure if it
handles exceptions well - I will test it)
As a result, the server side handlers are working as
expected when a handleRequest returns false.

Here is the code snippet from the SOAPService.invoke

-----------------------------
if (handlerFactory != null)
handlerImpl = (HandlerChainImpl)
handlerFactory.createHandlerChain();
boolean result = true;
try {
  if (handlerImpl != null) {
    try {
     result = handlerImpl.handleRequest(msgContext);
   } catch (SOAPFaultException e) {
     handlerImpl.handleFault(msgContext);
     msgContext.setPastPivot(true);
     return;
  }
}

if (result) {
   try {
     super.invoke(msgContext);
  } catch (AxisFault e) {
      msgContext.setPastPivot(true);
     if (handlerImpl != null) {
      handlerImpl.handleFault(msgContext);
     }
     throw e;
  }
} else {
  msgContext.setPastPivot(true);
}

if ( handlerImpl != null) {
   handlerImpl.handleResponse(msgContext);
}
-------------------------

Am I missing something in the AxisClient which takes
care of these situations? 

Thanks,
Shantanu


Mime
View raw message