On Wed, May 13, 2009 at 9:22 PM, Andrew K Gatford <[email protected]>wrote:

>
> Hi Amilas,
>
> I've got to ask the question - why do we need to force the 202 ?

This is only for synapse nhttp transport. It works fine with axis2 http
transports.

When a RM Client sends and MakeConnection there is a possibility that server
sends a 202 Accepted header if there is nothing to reply. And also this
happens with TerminateSequenceResponse send by the client.

nhttp server worker code looked (when I start with this issue) like this,

String method = request.getRequestLine().getMethod().toUpperCase();
        if ("GET".equals(method)) {
            processGet();
        } else if ("POST".equals(method)) {
            processPost();
        } else {
            handleException("Unsupported method : " + method, null);
        }

        // processPost method calls for engine receive and it comes here

        if (msgContext != null &&
            msgContext.getOperationContext() != null &&

(!msgContext.getOperationContext().getAxisOperation().isControlOperation())
{

              this logic responsible for sending 202 accepted.

      }

Both make Connection and terminate sequence operations are controlled
operations. So non of them
go inside into the if block.

Then I came up with this solution.

1. Change the nhttp transport to send 202 accepted header if the message
context has FORCE_SC_ACCEPTED

      if (msgContext != null &&
            msgContext.getOperationContext() != null &&

(!msgContext.getOperationContext().getAxisOperation().isControlOperation()
||

msgContext.isPropertyTrue(NhttpConstants.FORCE_SC_ACCEPTED))) {

              this logic responsible for sending 202 accepted.

      }
2. Set this parameter at the Sandesha level.

If you have normal Axis2 http transport it has this logic for this,

if (TransportUtils.isResponseWritten(msgContext) ||
            ((requestResponseTransportControl != null) &&
             requestResponseTransportControl.getStatus().equals(

RequestResponseTransport.RequestResponseTransportStatus.SIGNALLED))) {
            // The response is written or signalled.  The current status is
used (probably SC_OK).
        } else {
            // The response may be ack'd, mark the status as accepted.
            response.setStatus(HttpStatus.SC_ACCEPTED);
        }

Problem here is two transports use different logic.



>
> We shouldn't need to Force at all as we get 202's from SequenceAcks etc.


We do get 202 for SequenceAcks for axis2 http transport. Actually I have
missed to test this with synapse nhttp.

>
>
> I think the problem is probably with the module.xml file that you are
> using.  David Parsons recently fixed an interop issue where we had
> misdefined the MakeConnection and Terminate messages as 2-way messages.  My
> thought would be that you aren't running with that change.  Can you check
> and see if the synapse transport is ok when the operations are defined
> correctly ?

will do a test with latest revision and confirm you. But I am feeling this
is not the case.

thanks,
Amila.


>
>
> Andrew Gatford
> Technical Project Lead
> Websphere ESB Foundation Technologies
> Hursley MP211
> IBM United Kingdom Laboratories, Hursley Park, Winchester, SO21 2JN
> Telephone :
> Internal (7) 245743
> External 01962 815743
> Internet : [email protected]
> ----- Forwarded by Andrew K Gatford/UK/IBM on 13/05/2009 16:39 -----
>  From: [email protected] To: [email protected] Date: 13/05/2009
> 07:57 Subject: svn commit: r774240 - in
> /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2:
> Sandesha2Constants.java msgprocessors/MakeConnectionProcessor.java
> msgprocessors/TerminateSeqResponseMsgProcessor.java
> ------------------------------
>
>
>
> Author: amilas
> Date: Wed May 13 06:57:00 2009
> New Revision: 774240
>
> URL: http://svn.apache.org/viewvc?rev=774240&view=rev
> Log:
> Set a property for make connections and terminate response messages to send
> 202 accepted
> header for synapse nhttp transport. Also increas the terminate message
> delay time suite for nhttp transport
> as well
>
> Modified:
>
>  
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/Sandesha2Constants.java
>
>  
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
>
>  
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
>
> Modified:
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/Sandesha2Constants.java
> URL:
> http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/Sandesha2Constants.java?rev=774240&r1=774239&r2=774240&view=diff
>
> ==============================================================================
> ---
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/Sandesha2Constants.java
> (original)
> +++
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/Sandesha2Constants.java
> Wed May 13 06:57:00 2009
> @@ -537,7 +537,7 @@
>
>                  int CLIENT_SLEEP_TIME = 10000;
>
> -                 int TERMINATE_DELAY = 100;
> +                 int TERMINATE_DELAY = 500;
>
>                  static final int TRANSPORT_WAIT_TIME = 60000;
>
>
> Modified:
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
> URL:
> http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java?rev=774240&r1=774239&r2=774240&view=diff
>
> ==============================================================================
> ---
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
> (original)
> +++
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/MakeConnectionProcessor.java
> Wed May 13 06:57:00 2009
> @@ -233,6 +233,8 @@
>
>          } else {
>
>                           if (LoggingControl.isAnyTracingEnabled() &&
> log.isDebugEnabled())
>
>                                            log.debug("Exit:
> MakeConnectionProcessor::processInMessage, no matching message found");
> +
>                            // this property indicate synapse nhttp transport
> to send a 202 Accepted header
> +
>  rmMsgCtx.getMessageContext().setProperty("FORCE_SC_ACCEPTED",
> Constants.VALUE_TRUE);
>
>                           return false;
>
>          }
>                                                                     } else
> {
>
> Modified:
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
> URL:
> http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java?rev=774240&r1=774239&r2=774240&view=diff
>
> ==============================================================================
> ---
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
> (original)
> +++
> webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/TerminateSeqResponseMsgProcessor.java
> Wed May 13 06:57:00 2009
> @@ -20,6 +20,7 @@
> package org.apache.sandesha2.msgprocessors;
>
> import org.apache.axis2.AxisFault;
> +import org.apache.axis2.Constants;
> import org.apache.axis2.context.ConfigurationContext;
> import org.apache.axis2.context.MessageContext;
> import org.apache.commons.logging.Log;
> @@ -78,7 +79,8 @@
>
>                                   // Stop this message travelling further
> through the Axis runtime
>                                   terminateResRMMsg.pause();
> -
> +                                  // this property indicate synapse nhttp
> transport to send a 202 Accepted header
> +
>  msgContext.setProperty("FORCE_SC_ACCEPTED", Constants.VALUE_TRUE);
>                                   if(log.isDebugEnabled()) log.debug("Exit:
> TerminateSeqResponseMsgProcessor::processInMessage " + Boolean.TRUE);
>                                   return true;
>   }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
>
>
>  ------------------------------
>
> *
> *
>
> *Unless stated otherwise above:
> IBM United Kingdom Limited - Registered in England and Wales with number
> 741598.
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
> *
>
>
>
>
>
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/

Reply via email to