axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From axis-...@ws.apache.org
Subject [jira] Commented: (AXIS-1335) MessageContext.setMessage() clashes with JAX-RPC Handler behavior
Date Sun, 26 Sep 2004 15:22:33 GMT
The following comment has been added to this issue:

     Author: Ian P. Springer
    Created: Sun, 26 Sep 2004 8:21 AM
       Body:
Algirdas,

In the section you quoted:

Return false to indicate blocking of the request handler chain. In this case, further
processing of the request handler chain is blocked and the target service endpoint is
not dispatched. The JAX-RPC runtime system takes the responsibility of invoking the
response handler chain next with the appropriate SOAPMessageContext. The Handler
implementation class has the responsibility of setting the response SOAP message in
the handleRequest method and perform additional processing in the
handleResponse method. In the default processing model, the response handler
chain starts processing from the same Handler instance (that returned false) and
goes backward in the execution sequence.


The spec is referring to setting a normal response message, not a fault message, as the patch
you submitted implies.

The subsequent paragraph in the spec:

Throw the javax.xml.rpc.soap.SOAPFaultException to indicate a SOAP fault.
The Handler implementation class has the responsibility of setting the SOAP fault in
the SOAP message in either handleRequest and/or handleFault method. If
SOAPFaultException is thrown by a server-side request handler's handleRequest
method, the HandlerChain terminates the further processing of the request handlers
in this handler chain and invokes the handleFault method on the HandlerChain
with the SOAP message context. Next, the HandlerChain invokes the handleFault
method on handlers registered in the handler chain, beginning with the Handler
instance that threw the exception and going backward in execution. The client-side
request handler's handleRequest method should not throw the SOAPFault-
Exception. Refer to the SOAP specification for details on the various SOAP
faultcode values and corresponding specification.

explains how handleRequest() should indicate a fault.

So, that being said, I think the first paragraph from the spec is a flaky one, considering
the spec and the Javadoc for SOAPMessageContext generally suggest:

 o the SOAPMessageContext passed to handleRequest() provides get/set access only to the request
SOAPMessage
 o the SOAPMessageContext passed to handleRequest() provides get/set access only to the response
SOAPMessage

You'll notice that the business about handleRequest() setting the response message when it
returns false has been removed from the JAX-RPC 1.2 spec.

Axis' current behavior: When a Handler X returns false in handleRequest, the handler chain
is short-circuited, and the next method Axis will invoke is handleResponse() on Handler X,
passing it a SOAPMessageContext that provides access to a freshly created response SOAPMessage.
Handler X can then populate the response message as it sees fit. IMO, this behavior is correct
and need not be changed.


---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/AXIS-1335?page=comments#action_53416

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/AXIS-1335

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: AXIS-1335
    Summary: MessageContext.setMessage() clashes with JAX-RPC Handler behavior
       Type: Bug

     Status: Open
   Priority: Major

    Project: Axis
 Components: 
             Basic Architecture

   Assignee: Davanum Srinivas
   Reporter: Algirdas Veitas

    Created: Sat, 24 Apr 2004 12:49 PM
    Updated: Sun, 26 Sep 2004 8:21 AM
Environment: Need to apply patch that was submitted in bug #1310

Description:
As per the JAX-RPC specification, when a JAX-RPC Handler returns a value "false" from handleRequest,
it is the responsibility of the Handler to set the appropriate response message, during the
invocation of handleRequest.  See below for relevant specification documentation.  If I am
misinterpreting, please let me know!! 

With that said, a JAX-RPC Compliant handler used within Axis cannot achieve the desired results
in this scenario.  When the handle calls
setMessage(SOAPMessage) to set the response message, the actual implementation of MessageContext
sets this value to the internal requestMessage because "havePastPivot" is set to false.  The
internal method of MessageContext is setCurrentMessage().

The following code snippet and documentaiton explains in more detail.  Full handler is attached.

public boolean handleRequest(MessageContext context) {

    SOAPMessageContext soapMsgContext = (SOAPMessageContext)context;
    SOAPMessage faultMessage = buildFaultMessage();

    // SETTING THE FAULT MESSAGE FOR THE RESPONSE ENVELOPE, HOWEVER
    // SINCE THIS IS A JAX-RPC HANDLER USING AXIS AND
    // org.apache.axis.MessageContext AS A CONCRETE IMPLEMENTATION
    // "havePastPivot" IS SET TO FALSE SO THIS FAULT MESSAGE
    // WILL BE ASSIGNED TO THE REQUEST MESSAGE!!
    soapMsgContext.setMessage(faultMessage);
    return false;
}

// 
public void setCurrentMessage(Message curMsg)
{
   curMsg.setMessageContext(this);

        if (havePassedPivot) {
            responseMessage = curMsg;
        } else {
            requestMessage = curMsg;
        }
    }
}

-- START RELEVANT JAX-RPC 1.1 DOCUMENTATION ----
"Return false to indicate blocking of the request handler chain. In this case, further processing
of the request handler chain is blocked and the target service endpoint is not dispatched.
The JAX-RPC runtime system takes the responsibility of invoking the response handler chain
next with the appropriate SOAPMessageContext. The Handler implementation class has the responsibility
of setting the response SOAP message in the handleRequest method and perform additional processing
in the handleResponse method. In the default processing model, the response handler chain
starts processing from the same Handler instance (that returned false) and
goes backward in the execution sequence."
-- END RELEVANT JAX-RPC 1.1 DOCUMENTATION ----



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message