You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by ga...@apache.org on 2007/02/05 15:58:47 UTC

svn commit: r503712 - in /webservices/sandesha/trunk/java: src/org/apache/sandesha2/ src/org/apache/sandesha2/msgprocessors/ src/org/apache/sandesha2/util/ test/src/org/apache/sandesha2/faulttests/

Author: gatfora
Date: Mon Feb  5 06:58:46 2007
New Revision: 503712

URL: http://svn.apache.org/viewvc?view=rev&rev=503712
Log:
Update code to generate wsrm:SequenceTerminated Faults

Added:
    webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/faulttests/SequenceTerminatedFaultTest.java
Modified:
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/FaultManager.java
    webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SOAPFaultEnvelopeCreator.java

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java?view=diff&rev=503712&r1=503711&r2=503712
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/Sandesha2Constants.java Mon Feb  5 06:58:46 2007
@@ -324,6 +324,8 @@
 			public static final int LAST_MESSAGE_NO_EXCEEDED = 5;
 
 			public static final int SEQUENCE_CLOSED = 6;
+
+			public static final int SEQUENCE_TERMINATED = 7;
 		}
 	}
 

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java?view=diff&rev=503712&r1=503711&r2=503712
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java Mon Feb  5 06:58:46 2007
@@ -34,6 +34,7 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.Handler.InvocationResponse;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
@@ -130,6 +131,13 @@
 		if (FaultManager.checkForUnknownSequence(rmMsgCtx, sequenceId, storageManager)) {
 			if (log.isDebugEnabled())
 				log.debug("Exit: AckRequestedProcessor::processAckRequestedHeader, Unknown sequence ");
+			return false;
+		}
+
+		// throwing a fault if the sequence is terminated
+		if (FaultManager.checkForSequenceTerminated(rmMsgCtx, sequenceId, rmdBean)) {
+			if (log.isDebugEnabled())
+				log.debug("Exit: AckRequestedProcessor::processAckRequestedHeader, Sequence terminated");
 			return false;
 		}
 

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java?view=diff&rev=503712&r1=503711&r2=503712
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/CloseSequenceProcessor.java Mon Feb  5 06:58:46 2007
@@ -90,6 +90,13 @@
 			return false;
 		}
 		
+		// throwing a fault if the sequence is terminated
+		if (FaultManager.checkForSequenceTerminated(rmMsgCtx, sequenceId, rmdBean)) {
+			if (log.isDebugEnabled())
+				log.debug("Exit: CloseSequenceProcessor::processInMessage, Sequence terminated");
+			return false;
+		}
+
 		rmdBean.setClosed(true);
 		storageManager.getRMDBeanMgr().update(rmdBean);
 

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=503712&r1=503711&r2=503712
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/msgprocessors/SequenceProcessor.java Mon Feb  5 06:58:46 2007
@@ -135,6 +135,13 @@
 		sequence.setMustUnderstand(false);
 		rmMsgCtx.addSOAPEnvelope();
 
+		// throwing a fault if the sequence is terminated
+		if (FaultManager.checkForSequenceTerminated(rmMsgCtx, sequenceId, bean)) {
+			if (log.isDebugEnabled())
+				log.debug("Exit: SequenceProcessor::processReliableMessage, Sequence terminated");
+			return InvocationResponse.ABORT;
+		}
+		
 		// throwing a fault if the sequence is closed.
 		if (FaultManager.checkForSequenceClosed(rmMsgCtx, sequenceId, bean)) {
 			if (log.isDebugEnabled())

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/FaultManager.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/FaultManager.java?view=diff&rev=503712&r1=503711&r2=503712
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/FaultManager.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/FaultManager.java Mon Feb  5 06:58:46 2007
@@ -327,6 +327,52 @@
 		getOrSendFault(rmMessageContext, data);
 	}
 	
+	/**
+	 * Checks if a sequence is terminated and returns a SequenceTerminated fault.
+	 * @param referenceRMMessage
+	 * @param sequenceID
+	 * @param rmdBean
+	 * @return
+	 * @throws AxisFault 
+	 */
+	public static boolean checkForSequenceTerminated(RMMsgContext referenceRMMessage, String sequenceID, RMDBean rmdBean) 
+	
+	throws AxisFault {
+		if (log.isDebugEnabled())
+			log.debug("Enter: FaultManager::checkForSequenceClosed, " + sequenceID);
+
+		if (rmdBean.isTerminated()) {
+			MessageContext referenceMessage = referenceRMMessage.getMessageContext();
+			FaultData data = new FaultData();
+			int SOAPVersion = SandeshaUtil.getSOAPVersion(referenceMessage.getEnvelope());
+			if (SOAPVersion == Sandesha2Constants.SOAPVersion.v1_1)
+				data.setCode(SOAP11Constants.FAULT_CODE_SENDER);
+			else
+				data.setCode(SOAP12Constants.FAULT_CODE_SENDER);
+
+			data.setSubcode(Sandesha2Constants.SOAPFaults.Subcodes.SEQUENCE_TERMINATED);
+			data.setReason(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.cannotSendMsgAsSequenceTerminated, sequenceID));
+			data.setType(Sandesha2Constants.SOAPFaults.FaultType.SEQUENCE_TERMINATED);
+			
+			SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SOAPVersion);
+			String rmNamespaceValue = referenceRMMessage.getRMNamespaceValue();
+			OMElement identifierElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.IDENTIFIER,
+					rmNamespaceValue, Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
+			identifierElement.setText(sequenceID);
+			
+			data.setDetail(identifierElement);
+
+			if (log.isDebugEnabled())
+				log.debug("Exit: FaultManager::checkForSequenceClosed, sequence closed");
+			getOrSendFault(referenceRMMessage, data);
+			return true;
+		}
+
+		if (log.isDebugEnabled())
+			log.debug("Exit: FaultManager::checkForSequenceClosed");
+		return false;
+  }
+
 	public static boolean checkForSequenceClosed(RMMsgContext referenceRMMessage, String sequenceID,
 			RMDBean rmdBean) throws AxisFault {
 		if (log.isDebugEnabled())
@@ -580,5 +626,4 @@
 		}
 	  return false;
   }
-
 }

Modified: webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SOAPFaultEnvelopeCreator.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SOAPFaultEnvelopeCreator.java?view=diff&rev=503712&r1=503711&r2=503712
==============================================================================
--- webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SOAPFaultEnvelopeCreator.java (original)
+++ webservices/sandesha/trunk/java/src/org/apache/sandesha2/util/SOAPFaultEnvelopeCreator.java Mon Feb  5 06:58:46 2007
@@ -98,6 +98,8 @@
 			sequenceFault = true;
 		else if (faultType == Sandesha2Constants.SOAPFaults.FaultType.SEQUENCE_CLOSED)
 			sequenceFault = true;
+		else if (faultType == Sandesha2Constants.SOAPFaults.FaultType.SEQUENCE_TERMINATED)
+			sequenceFault = true;
 
 		return sequenceFault;
 

Added: webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/faulttests/SequenceTerminatedFaultTest.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/faulttests/SequenceTerminatedFaultTest.java?view=auto&rev=503712
==============================================================================
--- webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/faulttests/SequenceTerminatedFaultTest.java (added)
+++ webservices/sandesha/trunk/java/test/src/org/apache/sandesha2/faulttests/SequenceTerminatedFaultTest.java Mon Feb  5 06:58:46 2007
@@ -0,0 +1,413 @@
+/*
+ * Copyright 2007 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sandesha2.faulttests;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.impl.llom.soap11.SOAP11Factory;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.Sandesha2Constants;
+import org.apache.sandesha2.SandeshaTestCase;
+import org.apache.sandesha2.msgreceivers.RMMessageReceiver;
+import org.apache.sandesha2.storage.StorageManager;
+import org.apache.sandesha2.storage.Transaction;
+import org.apache.sandesha2.storage.beanmanagers.RMDBeanMgr;
+import org.apache.sandesha2.storage.beans.RMDBean;
+import org.apache.sandesha2.util.RangeString;
+import org.apache.sandesha2.util.SandeshaUtil;
+import org.apache.sandesha2.util.SpecSpecificConstants;
+import org.apache.sandesha2.wsrm.AckRequested;
+import org.apache.sandesha2.wsrm.CloseSequence;
+import org.apache.sandesha2.wsrm.Identifier;
+import org.apache.sandesha2.wsrm.MessageNumber;
+import org.apache.sandesha2.wsrm.Sequence;
+
+
+public class SequenceTerminatedFaultTest extends SandeshaTestCase {
+
+	private static final String server_repoPath = "target" + File.separator
+	    + "repos" + File.separator + "server";
+
+	private static final String server_axis2_xml = "target" + File.separator
+	    + "repos" + File.separator + "server" + File.separator
+	    + "server_axis2.xml";
+	
+	private static ConfigurationContext serverConfigContext;
+	
+	private static boolean serverStarted = false;
+	
+	public SequenceTerminatedFaultTest() {
+		super("SequenceTerminatedFaultTest");
+	}
+
+	public void setUp() throws Exception {
+		super.setUp();
+		if (!serverStarted) {
+			serverConfigContext = startServer(server_repoPath, server_axis2_xml);
+		}
+		serverStarted = true;
+	}
+
+	public void tearDown () {
+	}
+
+	/**
+	 * Sends an application message to the RMD.
+	 * The RMD should reject the message with a sequence terminated fault
+	 * 
+	 * @throws Exception
+	 */
+	public void testSequenceTerminatedFault() throws Exception {
+    // Open a connection to the endpoint
+		HttpURLConnection connection = 
+			FaultTestUtils.getHttpURLConnection("http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService",
+					pingAction);
+
+		StorageManager storageManager = 
+			SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
+		
+		RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
+		
+		String seqID = SandeshaUtil.getUUID();
+		
+		// Mockup an RMDBean
+		RMDBean rmdBean = new RMDBean();
+		rmdBean.setSequenceID(seqID);
+		rmdBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
+		rmdBean.setServerCompletedMessages(new RangeString());
+		// Flag that the sequence is terminated.
+		rmdBean.setTerminated(true);
+		
+		// Create a transaction and insert the RMSBean
+		Transaction tran = storageManager.getTransaction();
+		
+		rmdBeanMgr.insert(rmdBean);
+		
+		tran.commit();
+
+		
+		OutputStream tmpOut2 = connection.getOutputStream();
+
+		byte ar[] = getAppMessageAsBytes(seqID);
+		// Send the message to the socket.
+		tmpOut2.write(ar);
+		tmpOut2.flush();
+
+		// Get the response message from the connection
+		String message = FaultTestUtils.retrieveResponseMessage(connection);
+    
+    // Check that the fault message isn't null
+    assertNotNull(message);
+    
+    // Check that the response contains the Sequence Terminated tag    
+    assertTrue(message.indexOf("wsrm:SequenceTerminated") > -1);
+    
+    // Check that the <wsrm:Identifier>seqID</wsrm:Identifier> matches the sequence ID specified
+    String faultID = message.substring(message.indexOf("<wsrm:Identifier>") + 17, message.indexOf("</wsrm:Identifier>"));
+    assertEquals(seqID, faultID);
+    
+    // Disconnect at the end of the test
+    connection.disconnect();
+	}
+	
+	/**
+	 * Sends a Close message to the RMD.
+	 * The RMD should reject the message with a sequence terminated fault
+	 * 
+	 * @throws Exception
+	 */
+	public void testSequenceTerminatedOnCloseFault() throws Exception {
+    // Open a connection to the endpoint
+		HttpURLConnection connection = 
+			FaultTestUtils.getHttpURLConnection("http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService",
+					Sandesha2Constants.SPEC_2006_08.Actions.ACTION_CLOSE_SEQUENCE);
+
+		StorageManager storageManager = 
+			SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
+		
+		RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
+		
+		String seqID = SandeshaUtil.getUUID();
+		
+		// Mockup an RMDBean
+		RMDBean rmdBean = new RMDBean();
+		rmdBean.setSequenceID(seqID);
+		rmdBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
+		rmdBean.setServerCompletedMessages(new RangeString());
+		// Flag that the sequence is terminated.
+		rmdBean.setTerminated(true);
+		
+		// Create a transaction and insert the RMSBean
+		Transaction tran = storageManager.getTransaction();
+		
+		rmdBeanMgr.insert(rmdBean);
+		
+		tran.commit();
+
+		
+		OutputStream tmpOut2 = connection.getOutputStream();
+
+		byte ar[] = getCloseMessageAsBytes(seqID);
+		// Send the message to the socket.
+		tmpOut2.write(ar);
+		tmpOut2.flush();
+
+		// Get the response message from the connection
+		String message = FaultTestUtils.retrieveResponseMessage(connection);
+    
+    // Check that the fault message isn't null
+    assertNotNull(message);
+    
+    // Check that the response contains the Sequence Terminated tag    
+    assertTrue(message.indexOf("wsrm:SequenceTerminated") > -1);
+    
+    // Check that the <wsrm:Identifier>seqID</wsrm:Identifier> matches the sequence ID specified
+    String faultID = message.substring(message.indexOf("<wsrm:Identifier>") + 17, message.indexOf("</wsrm:Identifier>"));
+    assertEquals(seqID, faultID);
+    
+    // Disconnect at the end of the test
+    connection.disconnect();
+	}
+
+	/**
+	 * Sends a AckRequest message to the RMD.
+	 * The RMD should reject the message with a sequence terminated fault
+	 * 
+	 * @throws Exception
+	 */
+	public void testSequenceTerminatedOnAckRequestFault() throws Exception {
+    // Open a connection to the endpoint
+		HttpURLConnection connection = 
+			FaultTestUtils.getHttpURLConnection("http://127.0.0.1:" + serverPort + "/axis2/services/RMSampleService",
+					Sandesha2Constants.SPEC_2006_08.Actions.ACTION_ACK_REQUEST);
+
+		StorageManager storageManager = 
+			SandeshaUtil.getSandeshaStorageManager(serverConfigContext, serverConfigContext.getAxisConfiguration());
+		
+		RMDBeanMgr rmdBeanMgr = storageManager.getRMDBeanMgr();
+		
+		String seqID = SandeshaUtil.getUUID();
+		
+		// Mockup an RMDBean
+		RMDBean rmdBean = new RMDBean();
+		rmdBean.setSequenceID(seqID);
+		rmdBean.setToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setAcksToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setReplyToEPR(AddressingConstants.Final.WSA_ANONYMOUS_URL);
+		rmdBean.setRMVersion(Sandesha2Constants.SPEC_VERSIONS.v1_1);
+		rmdBean.setServerCompletedMessages(new RangeString());
+		// Flag that the sequence is terminated.
+		rmdBean.setTerminated(true);
+		
+		// Create a transaction and insert the RMSBean
+		Transaction tran = storageManager.getTransaction();
+		
+		rmdBeanMgr.insert(rmdBean);
+		
+		tran.commit();
+
+		
+		OutputStream tmpOut2 = connection.getOutputStream();
+
+		byte ar[] = getAckRequestMessageAsBytes(seqID);
+		// Send the message to the socket.
+		tmpOut2.write(ar);
+		tmpOut2.flush();
+
+		// Get the response message from the connection
+		String message = FaultTestUtils.retrieveResponseMessage(connection);
+    
+    // Check that the fault message isn't null
+    assertNotNull(message);
+    
+    // Check that the response contains the Sequence Terminated tag    
+    assertTrue(message.indexOf("wsrm:SequenceTerminated") > -1);
+    
+    // Check that the <wsrm:Identifier>seqID</wsrm:Identifier> matches the sequence ID specified
+    String faultID = message.substring(message.indexOf("<wsrm:Identifier>") + 17, message.indexOf("</wsrm:Identifier>"));
+    assertEquals(seqID, faultID);
+    
+    // Disconnect at the end of the test
+    connection.disconnect();
+	}
+
+	/**
+	 * Get an application message as bytes
+	 * 
+	 * @return
+	 */
+	private byte[] getAppMessageAsBytes(String uuid) throws Exception
+	{
+		SOAPFactory factory = new SOAP11Factory();
+		SOAPEnvelope dummyEnvelope = factory.getDefaultEnvelope();
+		
+		// Create a "new" application message
+		MessageContext messageContext = new MessageContext();
+		messageContext.setConfigurationContext(serverConfigContext);
+		messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));		
+		messageContext.setEnvelope(dummyEnvelope);
+		
+		RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
+		
+		// Generate the Sequence field.
+		// -------------------------------
+		String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);
+
+		Sequence sequence = new Sequence(rmNamespaceValue);
+		MessageNumber msgNumber = new MessageNumber(rmNamespaceValue);
+		msgNumber.setMessageNumber(1);
+		sequence.setMessageNumber(msgNumber);
+		Identifier id1 = new Identifier(rmNamespaceValue);
+		id1.setIndentifer(uuid);
+		sequence.setIdentifier(id1);
+		applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.SEQUENCE, sequence);
+		applicationRMMsg.addSOAPEnvelope();
+
+		// --------------------------------------------
+		// Finished generating Sequence part
+		
+		// Create an RMSBean so the create sequence message can be created
+		messageContext.setWSAAction(pingAction);
+
+		// Set the AxisOperation to be InOut
+		AxisOperation operation = messageContext.getAxisService().getOperation(new QName("RMInOutOperation"));
+		operation.setMessageReceiver(new RMMessageReceiver());
+		messageContext.setAxisOperation(operation);
+
+		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+		
+		// Serialize the application message
+		applicationRMMsg.getMessageContext().getEnvelope().serialize(outputStream);
+		
+		return outputStream.toByteArray();
+	}
+	
+	/**
+	 * Get a close message as bytes
+	 * 
+	 * @return
+	 */
+	private byte[] getCloseMessageAsBytes(String uuid) throws Exception
+	{
+		SOAPFactory factory = new SOAP11Factory();
+		SOAPEnvelope dummyEnvelope = factory.getDefaultEnvelope();
+		
+		// Create a "new" application message
+		MessageContext messageContext = new MessageContext();
+		messageContext.setConfigurationContext(serverConfigContext);
+		messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));		
+		messageContext.setEnvelope(dummyEnvelope);
+		
+		RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
+		
+		// Generate the Close field.
+		// -------------------------------
+		String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);
+
+		CloseSequence sequence = new CloseSequence(rmNamespaceValue);
+		Identifier id1 = new Identifier(rmNamespaceValue);
+		id1.setIndentifer(uuid);
+		sequence.setIdentifier(id1);
+		applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE, sequence);
+		applicationRMMsg.addSOAPEnvelope();
+
+		// --------------------------------------------
+		// Finished generating Close part
+		
+		// Create an RMSBean so the create sequence message can be created
+		messageContext.setWSAAction(pingAction);
+
+		// Set the AxisOperation to be InOut
+		AxisOperation operation = messageContext.getAxisService().getOperation(new QName("RMInOutOperation"));
+		operation.setMessageReceiver(new RMMessageReceiver());
+		messageContext.setAxisOperation(operation);
+
+		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+		
+		// Serialize the application message
+		applicationRMMsg.getMessageContext().getEnvelope().serialize(outputStream);
+		
+		return outputStream.toByteArray();
+	}
+
+	/**
+	 * Get a close message as bytes
+	 * 
+	 * @return
+	 */
+	private byte[] getAckRequestMessageAsBytes(String uuid) throws Exception
+	{
+		SOAPFactory factory = new SOAP11Factory();
+		SOAPEnvelope dummyEnvelope = factory.getDefaultEnvelope();
+		
+		// Create a "new" application message
+		MessageContext messageContext = new MessageContext();
+		messageContext.setConfigurationContext(serverConfigContext);
+		messageContext.setAxisService(serverConfigContext.getAxisConfiguration().getService("RMSampleService"));		
+		messageContext.setEnvelope(dummyEnvelope);
+		
+		RMMsgContext applicationRMMsg = new RMMsgContext(messageContext);
+		
+		// Generate the Close field.
+		// -------------------------------
+		String rmNamespaceValue = SpecSpecificConstants.getRMNamespaceValue(Sandesha2Constants.SPEC_VERSIONS.v1_1);
+
+		AckRequested sequence = new AckRequested(rmNamespaceValue);
+		Identifier id1 = new Identifier(rmNamespaceValue);
+		id1.setIndentifer(uuid);
+		sequence.setIdentifier(id1);
+		applicationRMMsg.setMessagePart(Sandesha2Constants.MessageParts.CLOSE_SEQUENCE, sequence);
+		applicationRMMsg.addSOAPEnvelope();
+
+		// --------------------------------------------
+		// Finished generating Close part
+		
+		// Create an RMSBean so the create sequence message can be created
+		messageContext.setWSAAction(pingAction);
+
+		// Set the AxisOperation to be InOut
+		AxisOperation operation = messageContext.getAxisService().getOperation(new QName("RMInOutOperation"));
+		operation.setMessageReceiver(new RMMessageReceiver());
+		messageContext.setAxisOperation(operation);
+
+		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+		
+		// Serialize the application message
+		applicationRMMsg.getMessageContext().getEnvelope().serialize(outputStream);
+		
+		return outputStream.toByteArray();
+	}
+
+}
+



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