You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by ch...@apache.org on 2007/03/25 19:33:14 UTC

svn commit: r522307 - in /webservices/sandesha/trunk/java/src/org/apache/sandesha2: RMMsgContext.java msgprocessors/ApplicationMsgProcessor.java msgprocessors/SequenceProcessor.java util/SequenceManager.java

Author: chamikara
Date: Sun Mar 25 10:33:14 2007
New Revision: 522307

URL: http://svn.apache.org/viewvc?view=rev&rev=522307
Log:
Avioded rewriting of the Addressing anonymous URI for WSRM 1.0 messages.
Avoided standalone acks in the WSRM 1.0 anonyous InOut scneario. If such an ack get returned the client may assume the 
message to be InOnly and avoid from replaying request msgs to get the response.

Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java?view=diff&rev=522307&r1=522306&r2=522307
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/RMMsgContext.java Sun Mar 25 10:33:14 2007
@@ -27,6 +27,7 @@
 import org.apache.axis2.addressing.RelatesTo;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.sandesha2.client.SandeshaClientConstants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 import org.apache.sandesha2.wsrm.IOMRMPart;
 
@@ -306,6 +307,12 @@
 	}
 	
 	public String getRMSpecVersion () {
+		if (rmSpecVersion==null) {
+			//this may hv been set in the Options object.
+			if (msgContext!=null && msgContext.getOptions()!=null)
+			rmSpecVersion = (String) msgContext.getOptions().getProperty(SandeshaClientConstants.RM_SPEC_VERSION);
+		}
+		
 		return rmSpecVersion;
 	}
 	

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?view=diff&rev=522307&r1=522306&r2=522307
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Sun Mar 25 10:33:14 2007
@@ -286,18 +286,23 @@
 				rmsBean.setExpectedReplies(expectedReplies + 1);
 
 				// If we support the RM anonymous URI then rewrite the ws-a anon to use the RM equivalent.
-				EndpointReference oldEndpoint = msgContext.getReplyTo();
-				String oldAddress = (oldEndpoint == null) ? null : oldEndpoint.getAddress(); 
-				EndpointReference newReplyTo = SandeshaUtil.rewriteEPR(rmsBean, msgContext.getReplyTo(), configContext);
-				String newAddress = (newReplyTo == null) ? null : newReplyTo.getAddress();
-				if(newAddress != null && !newAddress.equals(oldAddress)) {
-					// We have rewritten the replyTo. If this is the first message that we have needed to
-					// rewrite then we should set the sequence up for polling, and once we have saved the
-					// changes to the sequence then we can start the polling thread.
-					msgContext.setReplyTo(newReplyTo);
-					if(!rmsBean.isPollingMode()) {
-						rmsBean.setPollingMode(true);
-						startPolling = true;
+				//(do should be done only for WSRM 1.1)
+				
+				if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(rmMsgCtx.getRMSpecVersion())) {
+					EndpointReference oldEndpoint = msgContext.getReplyTo();
+					String oldAddress = (oldEndpoint == null) ? null : oldEndpoint.getAddress();
+					EndpointReference newReplyTo = SandeshaUtil.rewriteEPR(rmsBean, msgContext
+							.getReplyTo(), configContext);
+					String newAddress = (newReplyTo == null) ? null : newReplyTo.getAddress();
+					if (newAddress != null && !newAddress.equals(oldAddress)) {
+						// We have rewritten the replyTo. If this is the first message that we have needed to
+						// rewrite then we should set the sequence up for polling, and once we have saved the
+						// changes to the sequence then we can start the polling thread.
+						msgContext.setReplyTo(newReplyTo);
+						if (!rmsBean.isPollingMode()) {
+							rmsBean.setPollingMode(true);
+							startPolling = true;
+						}
 					}
 				}
 			}

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java?view=diff&rev=522307&r1=522306&r2=522307
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java Sun Mar 25 10:33:14 2007
@@ -228,7 +228,14 @@
 			EndpointReference acksTo = new EndpointReference (bean.getAcksToEPR());
 			
 			// Send an Ack if needed.
-			sendAckIfNeeded(bean, sequenceId, rmMsgCtx, storageManager, true, acksTo.hasAnonymousAddress());			
+			//We are not sending acks for duplicate messages in the RM 1.0 anon InOut case.
+			//If a standalone ack get sent before the actualy message (I.e. before the original msg get
+			//replied), the client may take this as a InOnly message and may avoid looking for the application
+			//response.
+			if (!(Sandesha2Constants.SPEC_VERSIONS.v1_0.equals(rmMsgCtx.getRMSpecVersion()) && 
+					rmMsgCtx.getReplyTo().hasAnonymousAddress())) {
+				sendAckIfNeeded(bean, sequenceId, rmMsgCtx, storageManager, true, acksTo.hasAnonymousAddress());	
+			}
 			
 			result = InvocationResponse.ABORT;
 			if (log.isDebugEnabled())

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java?view=diff&rev=522307&r1=522306&r2=522307
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SequenceManager.java Sun Mar 25 10:33:14 2007
@@ -257,9 +257,13 @@
 			}
 		}
 		// In case either of the replyTo or AcksTo is anonymous, rewrite them using the AnonURI template
+		//(this should be done only for RM 1.1)
 		ConfigurationContext config = firstAplicationMsgCtx.getConfigurationContext();
-		replyToEPR = SandeshaUtil.rewriteEPR(rmsBean, replyToEPR, config);
-		acksToEPR = SandeshaUtil.rewriteEPR(rmsBean, acksToEPR, config);
+		
+		if (Sandesha2Constants.SPEC_VERSIONS.v1_1.equals(specVersion)) {
+			replyToEPR = SandeshaUtil.rewriteEPR(rmsBean, replyToEPR, config);
+			acksToEPR = SandeshaUtil.rewriteEPR(rmsBean, acksToEPR, config);
+		}
 		
 		// Store both the acksTo and replyTo 
 		if(replyToEPR != null) rmsBean.setReplyToEPR(replyToEPR.getAddress());



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org