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 am...@apache.org on 2008/10/20 06:41:48 UTC

svn commit: r706119 - in /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2: client/SandeshaClientConstants.java util/RMMsgCreator.java util/SequenceManager.java

Author: amilas
Date: Sun Oct 19 21:41:47 2008
New Revision: 706119

URL: http://svn.apache.org/viewvc?rev=706119&view=rev
Log:
fixed the issue SANDESHA2-178

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClientConstants.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SequenceManager.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClientConstants.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClientConstants.java?rev=706119&r1=706118&r2=706119&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClientConstants.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/client/SandeshaClientConstants.java Sun Oct 19 21:41:47 2008
@@ -39,4 +39,5 @@
 	public static final String AVOID_AUTO_TERMINATION = "AviodAutoTermination";
 	public static final String AUTO_START_NEW_SEQUENCE = "AutoStartNewSequence";
 	public static final String FORBID_MIXED_EPRS_ON_SEQUENCE = "ForbidMixedEPRsOnSequence";//if true means a sequence will not disallow both sync and async clients
+	public static final String ONE_WAY_SEQUENCE = "OneWaySequence"; // if set Sandesha2 will not send any sequene offers
 }

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java?rev=706119&r1=706118&r2=706119&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java Sun Oct 19 21:41:47 2008
@@ -34,6 +34,7 @@
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.util.MessageContextBuilder;
+import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
@@ -73,12 +74,12 @@
 public class RMMsgCreator {
 
 	private static Log log = LogFactory.getLog(RMMsgCreator.class);
-	
+
 	public static final String ACK_TO_BE_WRITTEN = "ackToBeWritten";
 
 	/**
 	 * Create a new CreateSequence message.
-	 * 
+	 *
 	 * @param applicationRMMsg
 	 * @param internalSequenceId
 	 * @param acksToEPR
@@ -87,7 +88,7 @@
 	 */
 	public static RMMsgContext createCreateSeqMsg(RMSBean rmsBean, RMMsgContext applicationRMMsg) throws AxisFault {
 		if(log.isDebugEnabled()) log.debug("Entry: RMMsgCreator::createCreateSeqMsg " + applicationRMMsg);
-		
+
 		MessageContext applicationMsgContext = applicationRMMsg.getMessageContext();
 		if (applicationMsgContext == null)
 			throw new SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.appMsgIsNull));
@@ -104,7 +105,7 @@
 
 		MessageContext createSeqmsgContext = SandeshaUtil
 				.createNewRelatedMessageContext(applicationRMMsg, createSequenceOperation);
-		
+
 		OperationContext createSeqOpCtx = createSeqmsgContext.getOperationContext();
 		String createSeqMsgId = SandeshaUtil.getUUID();
 		createSeqmsgContext.setMessageID(createSeqMsgId);
@@ -128,26 +129,31 @@
 				addressingNamespace = AddressingConstants.Final.WSA_NAMESPACE;
 		}
 		if(log.isDebugEnabled()) log.debug("RMMsgCreator:: addressing name space is " + addressingNamespace);
-		
+
 		// If acksTo has not been set, then default to anonymous, using the correct spec level
 		EndpointReference acksToEPR = rmsBean.getAcksToEndpointReference();
 		if(acksToEPR == null){
 			acksToEPR = new EndpointReference(SpecSpecificConstants.getAddressingAnonymousURI(addressingNamespace));
 		}
-		
+
 		CreateSequence createSequencePart = new CreateSequence(rmNamespaceValue);
 
 		// Check if this service includes 2-way operations
 		boolean twoWayService = false;
 		AxisService service = applicationMsgContext.getAxisService();
-		if(service != null) {
-			Parameter p = service.getParameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS);
-			if(p != null && p.getValue() != null) {
-				twoWayService = ((Boolean) p.getValue()).booleanValue();
-				if(log.isDebugEnabled()) log.debug("RMMsgCreator:: twoWayService " + twoWayService);
-			}
-		}
-		
+        if (service != null) {
+            // if the user has specified this sequence as a one way sequence it should not
+            // append the sequence offer.
+            if (!JavaUtils.isTrue(applicationMsgContext.getOptions().getProperty(
+                    SandeshaClientConstants.ONE_WAY_SEQUENCE))) {
+                Parameter p = service.getParameter(Sandesha2Constants.SERVICE_CONTAINS_OUT_IN_MEPS);
+                if (p != null && p.getValue() != null) {
+                    twoWayService = ((Boolean) p.getValue()).booleanValue();
+                    if (log.isDebugEnabled()) log.debug("RMMsgCreator:: twoWayService " + twoWayService);
+                }
+            }
+        }
+
 		// Adding sequence offer - if present. We send an offer if the client has assigned an
 		// id, or if we are using WS-RM 1.0 and the service contains out-in MEPs
 		boolean autoOffer = false;

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SequenceManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SequenceManager.java?rev=706119&r1=706118&r2=706119&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SequenceManager.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/util/SequenceManager.java Sun Oct 19 21:41:47 2008
@@ -26,6 +26,9 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.ClientUtils;
+import org.apache.axis2.description.WSDL2Constants;
 import org.apache.axis2.util.JavaUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -230,7 +233,35 @@
 				replyToEPR = null;
 			}
 
-			// For client-side sequences there are 3 options:
+            // if this is an in only service invocation and if the user has set the
+            // use seperate listner option then it should work as an dual channel model.
+            if ((replyToEPR == null) && firstAplicationMsgCtx.getOptions().isUseSeparateListener() &&
+                    firstAplicationMsgCtx.getAxisOperation().getMessageExchangePattern().equals(WSDL2Constants.MEP_URI_OUT_ONLY)){
+
+                // first check whether the transport in is set or not
+                TransportInDescription transportIn = firstAplicationMsgCtx.getTransportIn();
+                if (transportIn == null) {
+                    transportIn = firstAplicationMsgCtx.getOptions().getTransportIn();
+                }
+
+                //If use seperate listner is false then we have to use the annonymous end point.
+                if ((transportIn == null) && firstAplicationMsgCtx.getOptions().isUseSeparateListener()) {
+                    try {
+                        transportIn = ClientUtils.inferInTransport(
+                                firstAplicationMsgCtx.getConfigurationContext().getAxisConfiguration(),
+                                firstAplicationMsgCtx.getOptions(),
+                                firstAplicationMsgCtx);
+                        replyToEPR = firstAplicationMsgCtx.getConfigurationContext().getListenerManager().getEPRforService(
+                            firstAplicationMsgCtx.getAxisService().getName(),
+                            firstAplicationMsgCtx.getAxisOperation().getName().getLocalPart(),
+                            transportIn.getName());
+                    } catch (AxisFault axisFault) {
+                        throw new SandeshaException("Can not infer replyToEPR from the first message context ", axisFault);
+                    }
+                }
+            }
+
+            // For client-side sequences there are 3 options:
 			// 1) An explict AcksTo, set via the client API
 			// 2) The replyTo from the app message
 			// 3) The anonymous URI (for which we can leave a null EPR)



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