ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r293097 - in /webservices/sandesha/trunk: config/ src/org/apache/sandesha2/ src/org/apache/sandesha2/handlers/ src/org/apache/sandesha2/msgprocessors/ src/org/apache/sandesha2/storage/beanmanagers/ src/org/apache/sandesha2/storage/beans/ sr...
Date Sun, 02 Oct 2005 12:18:54 GMT
Author: chamikara
Date: Sun Oct  2 05:16:19 2005
New Revision: 293097

URL: http://svn.apache.org/viewcvs?rev=293097&view=rev
Log:
Added message retransmission part.
Added AcknowledgementProcesses - this stops the retransmittion of the acknowledged messages.

Added:
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
Modified:
    webservices/sandesha/trunk/config/module.xml
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java

Modified: webservices/sandesha/trunk/config/module.xml
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/config/module.xml?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/config/module.xml (original)
+++ webservices/sandesha/trunk/config/module.xml Sun Oct  2 05:16:19 2005
@@ -28,12 +28,10 @@
         <parameter name="wsamapping" locked="xsd:false">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse</parameter>
     </operation>
     
-<!--
-http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence
-http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence
-    <operation name="CreateSequence" mep="http://www.w3.org/2004/08/wsdl/in-out">
-        <parameter name="wsamapping" >http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</parameter>
+    <operation name="SequenceAcknowledgement" mep="http://www.w3.org/2004/08/wsdl/in-only">
         <messageReceiver class="org.apache.sandesha2.msgreceivers.RMMessageReceiver"/>
-    </operation>
- -->
+        <parameter name="wsamapping" locked="xsd:false">http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement</parameter>
+    </operation> 
+    
+   
 </module>

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Sun Oct  2 05:16:19
2005
@@ -133,12 +133,18 @@
 		String ACKS_TO_EPR = "acksToEPR";
 
 		String OUT_SEQUENCE_ID = "OutSequenceId";
+		
+		String INCOMING_SEQUENCE_ID = "IncomingSequenceId";
+		
+		String TEMP_SEQUENCE_ID = "TempSequenceId";
 
 		String REPLY_TO_EPR = "ReplyToEPR";
 		
 		String APP_MSG_PROCESSOR_LIST = "AppMsgProcessorList";
 		
 		String OUT_CREATE_SEQUENCE_SENT = "OutCreateSeqSent";
+		
+		String NEXT_MESSAGE_NUMBER = "NextMsgNo";
 	}
 
 	public interface SOAPVersion {
@@ -188,7 +194,9 @@
 	String OUT_HANDLER_NAME = "SandeshaOutHandler";
 
 	//message context properties
-	String APPLICATION_PROCESSING_DONE = "APP_PROCESSING_DONE";
+	String APPLICATION_PROCESSING_DONE = "AppProcessingDone";
+	
+	String ACK_WRITTEN = "AckWritten";
 
 	int INVOKER_SLEEP_TIME = 1000;
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java Sun Oct  2 05:16:19 2005
@@ -74,6 +74,10 @@
 					
 				 try {	 
 				 	updateMessage (msgCtx);
+				 	
+				 	Object obj = msgCtx.getProperty(
+                            MessageContext.CHARACTER_SET_ENCODING);
+				 	System.out.println("CHAR SET ENCODING:" + obj);
 					new AxisEngine(context).send(msgCtx);
 				} catch (AxisFault e1) {
 					e1.printStackTrace();
@@ -92,7 +96,8 @@
 			try {
 				Thread.sleep(2000);
 			} catch (InterruptedException e1) {
-				e1.printStackTrace();
+				//e1.printStackTrace();
+				System.out.println ("SENDER: Interupted Exception");
 			}
 		}
 		
@@ -122,6 +127,10 @@
 				else
 					throw new SandeshaException ("System context is null");
 			}
+			
+			
+			
+			rmMsgCtx.addSOAPEnvelope();
 		} catch (AxisFault e) {
 			throw new SandeshaException ("Exception in updating contexts");
 		}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java Sun
Oct  2 05:16:19 2005
@@ -52,6 +52,8 @@
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
 import org.apache.sandesha2.storage.beans.StorageMapBean;
 import org.apache.sandesha2.util.SandeshaUtil;
+import org.apache.sandesha2.wsrm.Identifier;
+import org.apache.sandesha2.wsrm.MessageNumber;
 import org.apache.sandesha2.wsrm.Sequence;
 import org.apache.wsdl.MessageReference;
 import org.apache.wsdl.WSDLConstants;
@@ -66,8 +68,9 @@
 	public void invoke(MessageContext msgCtx) throws AxisFault {
 		//log
 		System.out.println("In server OutHandler");
-		String DONE = (String) msgCtx.getProperty(Constants.APPLICATION_PROCESSING_DONE);
-		if (null!=DONE && "true".equals(DONE))
+		String DONE = (String) msgCtx
+				.getProperty(Constants.APPLICATION_PROCESSING_DONE);
+		if (null != DONE && "true".equals(DONE))
 			return;
 
 		//Strating the sender.
@@ -85,10 +88,10 @@
 		//getting the request message and rmMessage.
 		MessageContext reqMsgCtx = msgCtx.getOperationContext()
 				.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN);
-//		MessageContext temp = msgCtx.getOperationContext()
-//		.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT);
-//		
-		
+		//		MessageContext temp = msgCtx.getOperationContext()
+		//		.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT);
+		//		
+
 		RMMsgContext requestRMMsgCtx;
 		try {
 			requestRMMsgCtx = MsgInitializer.initializeMessage(reqMsgCtx);
@@ -98,13 +101,14 @@
 				AbstractContext context = rmMsgCtx.getContext();
 				if (context == null)
 					throw new SandeshaException("Context is null");
-				
-				Sequence sequence = (Sequence) requestRMMsgCtx
+
+				Sequence reqSequence = (Sequence) requestRMMsgCtx
 						.getMessagePart(Constants.MessageParts.SEQUENCE);
-				if (sequence == null)
+				if (reqSequence == null)
 					throw new SandeshaException("Sequence part is null");
 
-				String incomingSeqId = sequence.getIdentifier().getIdentifier();
+				String incomingSeqId = reqSequence.getIdentifier()
+						.getIdentifier();
 				if (incomingSeqId == null || incomingSeqId == "")
 					throw new SandeshaException("Invalid seqence Id");
 
@@ -139,21 +143,7 @@
 				if (soapBody.getChildElements().hasNext())
 					validResponse = true;
 
-				if (!validResponse) { //TODO either change MsgReceiver or move
-					if (Constants.WSA.NS_URI_ANONYMOUS.equals(acksToEPR
-							.getAddress())) {
-						Sequence reqSequence = (Sequence) requestRMMsgCtx
-								.getMessagePart(Constants.MessageParts.SEQUENCE);
-						if (reqSequence == null)
-							throw new SandeshaException(
-									"Sequence part of application message is null");
-
-						String sequenceId = reqSequence.getIdentifier()
-								.getIdentifier();
-
-						RMMsgCreator.addAckMessage(rmMsgCtx, sequenceId);
-					}
-				} else {
+				if (validResponse) {
 					//valid response
 
 					RMMsgContext ackRMMsgContext = RMMsgCreator
@@ -192,8 +182,16 @@
 
 					//processing the response
 					processResponseMessage(newRMMsgCtx, requestRMMsgCtx);
-					msgCtx.setPausedTrue(getName());
 
+					//let the request end with 202 if a ack has not been
+					// written in the incoming thread.
+					if (reqMsgCtx.getProperty(Constants.ACK_WRITTEN) == null
+							|| !"true".equals(reqMsgCtx
+									.getProperty(Constants.ACK_WRITTEN)))
+						reqMsgCtx.getOperationContext().setProperty(
+								org.apache.axis2.Constants.RESPONSE_WRITTEN,
+								"false");
+					msgCtx.setPausedTrue(getName());
 				}
 			}
 		} catch (SandeshaException e) {
@@ -250,7 +248,6 @@
 		rmMsg.setTo(incomingReplyTo);
 		rmMsg.setReplyTo(incomingTo);
 
-
 		rmMsg.getMessageContext().setPausedTrue(getName());
 
 		RMMsgContext copiedRMMsgCtx = SandeshaUtil.deepCopy(rmMsg);
@@ -260,8 +257,7 @@
 		Object val = msg.getOperationContext().getProperty(
 				org.apache.axis2.Constants.RESPONSE_WRITTEN);
 		copiedMsgCtx.setServiceGroupContext(msg.getServiceGroupContext());
-		copiedMsgCtx.setServiceGroupContextId(msg
-				.getServiceGroupContextId());
+		copiedMsgCtx.setServiceGroupContextId(msg.getServiceGroupContextId());
 		copiedMsgCtx.setServiceContext(msg.getServiceContext());
 		copiedMsgCtx.setServiceContextID(msg.getServiceContextID());
 		copiedMsgCtx.setOperationContext(msg.getOperationContext());
@@ -271,48 +267,127 @@
 		} catch (AxisFault e) {
 			e.printStackTrace();
 		}
-		
-		copiedMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE,"true");
+
+		copiedMsgCtx.setProperty(Constants.APPLICATION_PROCESSING_DONE, "true");
+
+		//Setting tempSequenceId
+		if (rmMsg.getMessageContext().isServerSide()) {
+
+		}
 
 		//Retransmitter bean entry for the application message
 		RetransmitterBean appMsgEntry = new RetransmitterBean();
-		String key = SandeshaUtil
-				.storeMessageContext(copiedMsgCtx);
+		String key = SandeshaUtil.storeMessageContext(copiedMsgCtx);
 		appMsgEntry.setKey(key);
 		appMsgEntry.setLastSentTime(0);
-		appMsgEntry.setTempSequenceId(incomingSeqId);
 		appMsgEntry.setMessageId(rmMsg.getMessageId());
-		
+
+		sequence = new Sequence();
+
+		long nextMsgNo = getNextMsgNo(rmMsg.getMessageContext()
+				.getSystemContext(), incomingSeqId);
+		MessageNumber msgNumber = new MessageNumber();
+		msgNumber.setMessageNumber(nextMsgNo);
+		sequence.setMessageNumber(msgNumber);
+
+		appMsgEntry.setMessageNumber(nextMsgNo);
+
 		if (outSequenceBean == null || outSequenceBean.getValue() == null) {
-			
 
+			//setting tempSequenceId;
+			String tempSequenceId = null;
+			if (msg.isServerSide()) {
+				tempSequenceId = incomingSeqId;
+			} else {
+				//TODO - deside tempSeqId for client side
+			}
 
-			SequencePropertyBean responseCreateSeqAdded = sequencePropertyMgr.retrieve(
+			if (tempSequenceId == null)
+				throw new SandeshaException("TempSequenceId is not set");
+
+			SequencePropertyBean tempSequenceBean = new SequencePropertyBean(
 					incomingSeqId,
-					Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT);
+					Constants.SequenceProperties.TEMP_SEQUENCE_ID,
+					tempSequenceId);
+			sequencePropertyMgr.insert(tempSequenceBean);
+
+			//Adding create sequence
+			SequencePropertyBean responseCreateSeqAdded = sequencePropertyMgr
+					.retrieve(
+							incomingSeqId,
+							Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT);
 
-			if (responseCreateSeqAdded == null || responseCreateSeqAdded.getValue() == null
+			if (responseCreateSeqAdded == null
+					|| responseCreateSeqAdded.getValue() == null
 					|| "".equals(responseCreateSeqAdded.getValue())) {
-				responseCreateSeqAdded = new SequencePropertyBean(incomingSeqId,
+				responseCreateSeqAdded = new SequencePropertyBean(
+						incomingSeqId,
 						Constants.SequenceProperties.OUT_CREATE_SEQUENCE_SENT,
 						"true");
 				sequencePropertyMgr.insert(responseCreateSeqAdded);
-				addCreateSequenceMessage(rmMsg,incomingSeqId);
+				addCreateSequenceMessage(rmMsg, incomingSeqId);
 			}
+			Identifier identifier = new Identifier();
+			identifier.setIndentifer("uuid:tempID");
+			sequence.setIdentifier(identifier);
 			appMsgEntry.setSend(false);
 		} else {
-			//Sequence id is present
-			//set sequence part
-			//add message to retransmitter table with send=true;
+			Identifier identifier = new Identifier();
+			identifier.setIndentifer((String) outSequenceBean.getValue());
+			sequence.setIdentifier(identifier);
 			appMsgEntry.setSend(true);
 		}
 
+		copiedRMMsgCtx
+				.setMessagePart(Constants.MessageParts.SEQUENCE, sequence);
+		try {
+			copiedRMMsgCtx.addSOAPEnvelope();
+		} catch (AxisFault e1) {
+			throw new SandeshaException(e1.getMessage());
+		}
+
+		//retrieving TempSequenceId
+		SequencePropertyBean tempSequenceBean = sequencePropertyMgr.retrieve(
+				incomingSeqId, Constants.SequenceProperties.TEMP_SEQUENCE_ID);
+		if (tempSequenceBean == null || tempSequenceBean.getValue() == null)
+			throw new SandeshaException("TempSequenceId is not set correctly");
+
+		String tempSequeneId = (String) tempSequenceBean.getValue();
+		appMsgEntry.setTempSequenceId(tempSequeneId);
 		retransmitterMgr.insert(appMsgEntry);
 
 	}
 
-	public void addCreateSequenceMessage(RMMsgContext applicationRMMsg,String incomingSequenceId)
-			throws SandeshaException {
+	private long getNextMsgNo(ConfigurationContext context, String incomingSeqId) {
+		//FIXME set a correct message number.
+		SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
+				.getInstance(context).getSequencePropretyBeanMgr();
+		SequencePropertyBean nextMsgNoBean = seqPropMgr.retrieve(incomingSeqId,
+				Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
+		long nextMsgNo = 1;
+		boolean update = false;
+		if (nextMsgNoBean != null) {
+			update = true;
+			Long nextMsgNoLng = (Long) nextMsgNoBean.getValue();
+			nextMsgNo = nextMsgNoLng.longValue();
+		} else {
+			nextMsgNoBean = new SequencePropertyBean();
+			nextMsgNoBean.setSequenceId(incomingSeqId);
+			nextMsgNoBean
+					.setName(Constants.SequenceProperties.NEXT_MESSAGE_NUMBER);
+		}
+
+		nextMsgNoBean.setValue(new Long(nextMsgNo + 1));
+		if (update)
+			seqPropMgr.update(nextMsgNoBean);
+		else
+			seqPropMgr.insert(nextMsgNoBean);
+
+		return nextMsgNo;
+	}
+
+	public void addCreateSequenceMessage(RMMsgContext applicationRMMsg,
+			String incomingSequenceId) throws SandeshaException {
 		MessageContext applicationMsg = applicationRMMsg.getMessageContext();
 		if (applicationMsg == null)
 			throw new SandeshaException("Message context is null");
@@ -323,11 +398,12 @@
 		if (context == null)
 			throw new SandeshaException("Context is null");
 
-		CreateSeqBeanMgr createSeqMgr = 
-			AbstractBeanMgrFactory.getInstance(context).getCreateSeqBeanMgr();
-		CreateSeqBean createSeqBean = new CreateSeqBean (incomingSequenceId,createSeqMsg.getMessageID(),null);
+		CreateSeqBeanMgr createSeqMgr = AbstractBeanMgrFactory.getInstance(
+				context).getCreateSeqBeanMgr();
+		CreateSeqBean createSeqBean = new CreateSeqBean(incomingSequenceId,
+				createSeqMsg.getMessageID(), null);
 		createSeqMgr.insert(createSeqBean);
-		
+
 		RetransmitterBeanMgr retransmitterMgr = AbstractBeanMgrFactory
 				.getInstance(context).getRetransmitterBeanMgr();
 		String key = SandeshaUtil.storeMessageContext(createSeqRMMessage

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java?rev=293097&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
(added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java
Sun Oct  2 05:16:19 2005
@@ -0,0 +1,125 @@
+/*
+ * Copyright 1999-2004 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.msgprocessors;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.axis2.context.AbstractContext;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.sandesha2.Constants;
+import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
+import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
+import org.apache.sandesha2.storage.beanmanagers.SequencePropertyBeanMgr;
+import org.apache.sandesha2.storage.beans.RetransmitterBean;
+import org.apache.sandesha2.storage.beans.SequencePropertyBean;
+import org.apache.sandesha2.wsrm.AcknowledgementRange;
+import org.apache.sandesha2.wsrm.Nack;
+import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
+
+public class AcknowledgementProcessor implements MsgProcessor {
+
+	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
+		System.out.println("WITHIN ACKNOWLEDGEMENT PROCESSOR");
+
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx
+				.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		if (sequenceAck == null)
+			throw new SandeshaException("Sequence acknowledgement part is null");
+
+		AbstractContext context = rmMsgCtx.getContext();
+		if (context == null)
+			throw new SandeshaException("Context is null");
+
+		Iterator ackRangeIterator = sequenceAck.getAcknowledgementRanges()
+				.iterator();
+		Iterator nackIterator = sequenceAck.getNackList().iterator();
+		String outSequenceId = sequenceAck.getIdentifier().getIdentifier();
+		if (outSequenceId == null || "".equals(outSequenceId))
+			throw new SandeshaException("OutSequenceId is null");
+
+		RetransmitterBeanMgr retransmitterMgr = AbstractBeanMgrFactory
+				.getInstance(context).getRetransmitterBeanMgr();
+		SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
+				.getInstance(context).getSequencePropretyBeanMgr();
+
+		//getting IncomingSequenceId for the outSequenceId
+		SequencePropertyBean incomingSequenceBean = seqPropMgr.retrieve(
+				outSequenceId,
+				Constants.SequenceProperties.INCOMING_SEQUENCE_ID);
+		if (incomingSequenceBean == null
+				|| incomingSequenceBean.getValue() == null)
+			throw new SandeshaException(
+					"Incoming Sequence id is not set correctly");
+
+		String incomingSequenceId = (String) incomingSequenceBean.getValue();
+
+		//getting TempSequenceId for the IncomingSequenceId
+		SequencePropertyBean tempSequenceBean = seqPropMgr.retrieve(
+				incomingSequenceId,
+				Constants.SequenceProperties.TEMP_SEQUENCE_ID);
+		if (tempSequenceBean == null || tempSequenceBean.getValue() == null)
+			throw new SandeshaException(
+					"Incoming Sequence id is not set correctly");
+
+		String tempSequenceId = (String) tempSequenceBean.getValue();
+
+		RetransmitterBean input = new RetransmitterBean();
+		input.setTempSequenceId(tempSequenceId);
+		Collection retransmitterEntriesOfSequence = retransmitterMgr
+				.find(input);
+
+		//TODO - make following more efficient
+		while (ackRangeIterator.hasNext()) {
+			AcknowledgementRange ackRange = (AcknowledgementRange) ackRangeIterator
+					.next();
+			long lower = ackRange.getLowerValue();
+			long upper = ackRange.getUpperValue();
+
+			for (long messageNo = lower; messageNo <= upper; messageNo++) {
+				RetransmitterBean retransmitterBean = getRetransmitterEntry(
+						retransmitterEntriesOfSequence, messageNo);
+				if (retransmitterBean != null)
+					retransmitterMgr.delete(retransmitterBean.getMessageId());
+			}
+		}
+
+		//TODO - make following more efficient
+		while (nackIterator.hasNext()) {
+			Nack nack = (Nack) nackIterator.next();
+			long msgNo = nack.getNackNumber();
+
+			//TODO - Process Nack
+		}
+	}
+
+	private RetransmitterBean getRetransmitterEntry(Collection collection,
+			long msgNo) {
+		Iterator it = collection.iterator();
+		while (it.hasNext()) {
+			RetransmitterBean bean = (RetransmitterBean) it.next();
+			if (bean.getMessageNumber() == msgNo)
+				return bean;
+		}
+
+		return null;
+	}
+}
\ No newline at end of file

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
Sun Oct  2 05:16:19 2005
@@ -14,6 +14,7 @@
  *  limitations under the License.
  *
  */
+
 package org.apache.sandesha2.msgprocessors;
 
 import java.util.ArrayList;
@@ -114,14 +115,10 @@
 		//TODO: Stop sending askc for every message.
 		SequencePropertyBean acksToBean = seqPropMgr.retrieve(sequenceId,
 				Constants.SequenceProperties.ACKS_TO_EPR);
-		String acksToStr = null;
-		try {
-			EndpointReference acksTo = (EndpointReference) acksToBean
-					.getValue();
-			acksToStr = acksTo.getAddress();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
+
+		EndpointReference acksTo = (EndpointReference) acksToBean.getValue();
+		String acksToStr = acksTo.getAddress();
+
 
 		//TODO: remove folowing 2.
 		System.out.println("Messages received:" + messagesStr);
@@ -162,17 +159,23 @@
 			}
 
 			//FIXME set acksTo instead of ReplyTo
-			ackMsgCtx.setTo(msgCtx.getReplyTo());
+			ackMsgCtx.setTo(acksTo);
 			ackMsgCtx.setReplyTo(msgCtx.getTo());
 			RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId);
 
 			AxisEngine engine = new AxisEngine(ackRMMsgCtx.getMessageContext()
 					.getSystemContext());
+		
+			
+			//set CONTEXT_WRITTEN since acksto is anonymous
+			rmMsgCtx.getMessageContext().getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,"true");
+			rmMsgCtx.getMessageContext().setProperty(Constants.ACK_WRITTEN,"true");
 			try {
 				engine.send(ackRMMsgCtx.getMessageContext());
 			} catch (AxisFault e1) {
 				throw new SandeshaException(e1.getMessage());
 			}
+			
 
 		} else {
 			//TODO Add async Ack

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
Sun Oct  2 05:16:19 2005
@@ -33,11 +33,18 @@
 import org.apache.sandesha2.wsrm.Identifier;
 import org.apache.sandesha2.wsrm.MessageNumber;
 import org.apache.sandesha2.wsrm.Sequence;
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.soap.SOAPEnvelope;
 
 import java.util.Iterator;
 
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
 public class CreateSeqResponseMsgProcessor implements MsgProcessor {
 	public void processMessage(RMMsgContext createSeqResponseRMMsgCtx)
 			throws SandeshaException {
@@ -78,9 +85,12 @@
 		SequencePropertyBeanMgr sequencePropMgr = AbstractBeanMgrFactory
 				.getInstance(configCtx).getSequencePropretyBeanMgr();
 		SequencePropertyBean outSequenceBean = new SequencePropertyBean(
-				incomingSequenceId,
+			incomingSequenceId,
 				Constants.SequenceProperties.OUT_SEQUENCE_ID, newOutSequenceId);
+		SequencePropertyBean incomingSequenceBean = new SequencePropertyBean (newOutSequenceId,
+				Constants.SequenceProperties.INCOMING_SEQUENCE_ID, incomingSequenceId);
 		sequencePropMgr.insert(outSequenceBean);
+		sequencePropMgr.insert(incomingSequenceBean);
 		
 		RetransmitterBean target = new RetransmitterBean();
 		target.setTempSequenceId(incomingSequenceId);
@@ -92,24 +102,32 @@
 			//updating the application message
 			String key = tempBean.getKey();
 			MessageContext applicationMsg = SandeshaUtil
-					.getStoredMessageContext(key);
+					.getStoredMessageContext(key);		
+			
 			RMMsgContext applicaionRMMsg = MsgInitializer
 					.initializeMessage(applicationMsg);
 
-			Sequence sequence = new Sequence();
+	
+			Sequence sequencePart = (Sequence) applicaionRMMsg.getMessagePart(Constants.MessageParts.SEQUENCE);

+			if (sequencePart==null)
+				throw new SandeshaException ("Sequence part is null");
+			
 			Identifier identifier = new Identifier ();
 			identifier.setIndentifer(newOutSequenceId);
-			sequence.setIdentifier(identifier);
 			
-			//FIXME set a correct message number.
-			MessageNumber msgNumber = new MessageNumber ();
-			msgNumber.setMessageNumber(1);
-			sequence.setMessageNumber(msgNumber);
-			applicaionRMMsg.setMessagePart(Constants.MessageParts.SEQUENCE,sequence);
-
+			sequencePart.setIdentifier(identifier);
+			try {
+				applicaionRMMsg.addSOAPEnvelope();
+			} catch (AxisFault e) {
+				throw new SandeshaException (e.getMessage());
+			}
+			
 			//asking to send the application msssage
 			tempBean.setSend(true);
 			retransmitterMgr.update(tempBean);
 		}
+		
+		createSeqResponseRMMsgCtx.getMessageContext().getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,"false");
+		
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/MsgProcessorFactory.java
Sun Oct  2 05:16:19 2005
@@ -36,6 +36,8 @@
 				return new ApplicationMsgProcessor ();
             case (Constants.MessageTypes.CREATE_SEQ_RESPONSE):
                 return new CreateSeqResponseMsgProcessor();
+            case (Constants.MessageTypes.ACK):
+            	return new AcknowledgementProcessor ();
             default:
 				return null;
 		}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java
Sun Oct  2 05:16:19 2005
@@ -29,5 +29,7 @@
 	public void processMessage(RMMsgContext rmMsgCtx)
 			throws SandeshaException {
 		//TODO Add terminate sequence message logic.
+		System.out.println("Terminate Sequence Processor called");
+		//rmMsgCtx.getMessageContext().setProperty("Status",new Integer (202));
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beanmanagers/RetransmitterBeanMgr.java
Sun Oct  2 05:16:19 2005
@@ -57,9 +57,9 @@
 	}
 
 	public boolean insert(RetransmitterBean bean) throws SandeshaException {
-		if (bean.getMessageId()==null)
-			throw new SandeshaException ("Key (MessageId) is null. Cant insert.");
-		
+		if (bean.getMessageId() == null)
+			throw new SandeshaException("Key (MessageId) is null. Cant insert.");
+
 		table.put(bean.getMessageId(), bean);
 		return true;
 	}
@@ -75,18 +75,9 @@
 		RetransmitterBean temp;
 		while (iterator.hasNext()) {
 			temp = (RetransmitterBean) iterator.next();
-			/*
-			 * if (!(bean.getMessageId() != null &&
-			 * bean.getMessageId().equals(temp.getMessageId())) &&
-			 * (bean.getCreateSeqMsgId() != null &&
-			 * bean.getCreateSeqMsgId().equals(temp.getCreateSeqMsgId())) &&
-			 * (bean.getKey() != null && bean.getKey().equals(temp.getKey())) &&
-			 * (bean.getLastSentTime() != -1 && bean.getLastSentTime() ==
-			 * temp.getLastSentTime())){
-			 * 
-			 * beans.add(temp); }
-			 */
+
 			boolean add = true;
+			
 			if (bean.getKey() != null && bean.getKey() != temp.getKey())
 				add = false;
 
@@ -102,14 +93,18 @@
 					&& bean.getTempSequenceId() != temp.getTempSequenceId())
 				add = false;
 
+			if (bean.getMessageNumber() > 0
+					&& bean.getMessageNumber() != temp.getMessageNumber())
+				add = false;
+
 			if (add)
 				beans.add(temp);
 		}
 
 		return beans;
 	}
-	
-	public Collection findMsgsToSend () {
+
+	public Collection findMsgsToSend() {
 		ArrayList beans = new ArrayList();
 		Iterator iterator = table.values().iterator();
 
@@ -120,12 +115,14 @@
 				long lastSentTime = temp.getLastSentTime();
 				int count = temp.getSentCount();
 				long timeNow = System.currentTimeMillis();
-				if (count==0 || (timeNow > lastSentTime+Constants.WSP.RETRANSMISSION_INTERVAL)) {
+				if (count == 0
+						|| (timeNow > lastSentTime
+								+ Constants.WSP.RETRANSMISSION_INTERVAL)) {
 					beans.add(temp);
 				}
 			}
 		}
-		
+
 		return beans;
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/beans/RetransmitterBean.java
Sun Oct  2 05:16:19 2005
@@ -19,9 +19,6 @@
 
 import java.io.Serializable;
 
-/**
- * @author  
- */
 public class RetransmitterBean implements Serializable {
 
 	private String messageId;
@@ -36,22 +33,22 @@
 
 	private int sentCount = 0;
 	
-	public RetransmitterBean() {
-
+	private long messageNumber = 0;
+	
+	public RetransmitterBean () {
+		
 	}
 
 	public RetransmitterBean(String messageId, String key, long lastSentTime,
-			boolean send, String tempSequenceId) {
+			boolean send, String tempSequenceId, long messageNumber) {
 		this.messageId = messageId;
 		this.key = key;
 		this.LastSentTime = lastSentTime;
 		this.Send = send;
 		this.tempSequenceId = tempSequenceId;
+		this.messageNumber = messageNumber;
 	}
 
-	/**
-	 * @return Returns the key.
-	 */
 	public String getKey() {
 		return key;
 	}
@@ -98,6 +95,14 @@
 	
 	public void setSentCount(int sentCount) {
 		this.sentCount = sentCount;
+	}
+	
+	public long getMessageNumber() {
+		return messageNumber;
+	}
+	
+	public void setMessageNumber(long messageNumber) {
+		this.messageNumber = messageNumber;
 	}
 	
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Sun Oct  2
05:16:19 2005
@@ -197,12 +197,17 @@
 		TransportInDescription transportIn = msgCtx.getTransportIn();
 		TransportOutDescription transportOut = msgCtx.getTransportOut();
 		MessageInformationHeaders msgInfoHeaders1 = new MessageInformationHeaders();
-		msgInfoHeaders1.setTo(msgCtx.getTo());
-		msgInfoHeaders1.setFrom(msgCtx.getFrom());
-		msgInfoHeaders1.setReplyTo(msgCtx.getReplyTo());
-		msgInfoHeaders1.setFaultTo(msgCtx.getFaultTo());
+		MessageInformationHeaders oldMsgInfoHeaders = msgCtx.getMessageInformationHeaders();
+		
+		msgInfoHeaders1.setTo(oldMsgInfoHeaders.getTo());
+		msgInfoHeaders1.setFrom(oldMsgInfoHeaders.getFrom());
+		msgInfoHeaders1.setReplyTo(oldMsgInfoHeaders.getReplyTo());
+		msgInfoHeaders1.setFaultTo(oldMsgInfoHeaders.getFaultTo());
 		msgInfoHeaders1.setMessageId(getUUID());
-
+		msgInfoHeaders1.setRelatesTo(oldMsgInfoHeaders.getRelatesTo());
+		msgInfoHeaders1.setAction(oldMsgInfoHeaders.getAction());
+		msgInfoHeaders1.setReferenceParameters(oldMsgInfoHeaders.getReferenceParameters());
+		
 		try {
 			
 			MessageContext newMessageContext = new MessageContext(configCtx,

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java Sun Oct  2
05:16:19 2005
@@ -132,6 +132,13 @@
 
 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
 		SOAPHeader header = envelope.getHeader();
+		
+		//detach if already exist.
+		OMElement elem = header.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
+				Constants.WSRM.ACK_REQUESTED));
+		if (elem!=null)
+			elem.detach();
+		
 		toOMElement(header);
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java Sun
Oct  2 05:16:19 2005
@@ -64,32 +64,13 @@
 
 	public Object fromOMElement(OMElement ackRangePart) throws OMException {
 
-		/*
-		 * OMElement ackRangePart = sequenceAckElement.getFirstChildWithName(
-		 * new QName (Constants.WSRM.NS_URI_RM,Constants.WSRM.ACK_RANGE));
-		 */
-
 		if (ackRangePart == null)
 			throw new OMException("The passed element is null");
 
-		
-		// serializing
-		try {
-			XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
-			ackRangePart.serialize(writer);
-		} catch (XMLStreamException e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		} catch (FactoryConfigurationError e1) {
-			// TODO Auto-generated catch block
-			e1.printStackTrace();
-		}
-		
-		
 		OMAttribute lowerAttrib = ackRangePart.getAttribute(new QName(
-				Constants.WSRM.NS_URI_RM,Constants.WSRM.LOWER));
+				Constants.WSRM.LOWER));
 		OMAttribute upperAttrib = ackRangePart.getAttribute(new QName(
-				Constants.WSRM.NS_URI_RM,Constants.WSRM.UPPER));
+				Constants.WSRM.UPPER));
 
 		if (lowerAttrib == null || upperAttrib == null)
 			throw new OMException(
@@ -125,10 +106,10 @@
 
 		OMAttribute lowerAttrib = SOAPAbstractFactory.getSOAPFactory(
 				Constants.SOAPVersion.DEFAULT).createOMAttribute(
-				Constants.WSRM.LOWER, rmNamespace, Long.toString(lowerValue));
+				Constants.WSRM.LOWER, null, Long.toString(lowerValue));
 		OMAttribute upperAttrib = SOAPAbstractFactory.getSOAPFactory(
 				Constants.SOAPVersion.DEFAULT).createOMAttribute(
-				Constants.WSRM.UPPER, rmNamespace, Long.toString(upperValue));
+				Constants.WSRM.UPPER, null, Long.toString(upperValue));
 
 		acknowledgementRangeElement.addAttribute(lowerAttrib);
 		acknowledgementRangeElement.addAttribute(upperAttrib);

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java Sun Oct 
2 05:16:19 2005
@@ -148,6 +148,13 @@
 
 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
 		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
+				Constants.WSRM.CREATE_SEQUENCE));
+		if (elem!=null)
+			elem.detach();
+		
 		toOMElement(body);
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java Sun
Oct  2 05:16:19 2005
@@ -160,6 +160,13 @@
 
 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
 		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
+				Constants.WSRM.CREATE_SEQUENCE_RESPONSE));
+		if (elem!=null)
+			elem.detach();
+		
 		toOMElement(body);
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java Sun Oct  2 05:16:19
2005
@@ -25,6 +25,10 @@
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.axis2.om.OMAbstractFactory;
 import org.apache.axis2.om.OMElement;
@@ -64,6 +68,21 @@
 	}
 
 	public Object fromOMElement(OMElement element) throws OMException {
+		
+		try {
+		System.out.println("PRINTING IDENTIFIER");
+
+		XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+		element.serialize(writer);
+	} catch (XMLStreamException e2) {
+		// TODO Auto-generated catch block
+		e2.printStackTrace();
+	} catch (FactoryConfigurationError e2) {
+		// TODO Auto-generated catch block
+		e2.printStackTrace();
+	}
+		
+		
 		OMElement identifierPart = element.getFirstChildWithName(new QName(
 				Constants.WSRM.NS_URI_RM, Constants.WSRM.IDENTIFIER));
 		if (identifierPart == null)

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java Sun Oct  2 05:16:19
2005
@@ -116,19 +116,19 @@
 			throw new OMException(
 					"Cant add Sequence part since MessageNumber is null");
 
-		identifier.toOMElement(sequenceElement);
-		messageNumber.toOMElement(sequenceElement);
-		if (lastMessage != null)
-			lastMessage.toOMElement(sequenceElement);
 
-		SOAPHeaderBlock soapHeaderBlock = soapHeader.addHeaderBlock(
+		SOAPHeaderBlock sequenceHeaderBlock = soapHeader.addHeaderBlock(
 				Constants.WSRM.SEQUENCE, seqNoNamespace);
-		soapHeaderBlock.setMustUnderstand(true);
-		soapHeaderBlock.addChild(sequenceElement);
+		sequenceHeaderBlock.setMustUnderstand(true);
+		identifier.toOMElement(sequenceHeaderBlock);
+		messageNumber.toOMElement(sequenceHeaderBlock);
+		if (lastMessage != null)
+			lastMessage.toOMElement(sequenceHeaderBlock);
+
 
 		//resetting the element. So that subsequest toOMElement calls will
 		// attach a different object.
-		sequenceElement = SOAPAbstractFactory.getSOAPFactory(
+		this.sequenceElement = SOAPAbstractFactory.getSOAPFactory(
 				Constants.SOAPVersion.DEFAULT).createOMElement(
 				Constants.WSRM.SEQUENCE, seqNoNamespace);
 
@@ -161,6 +161,13 @@
 
 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
 		SOAPHeader header = envelope.getHeader();
+		
+		//detach if already exist.
+		OMElement elem = header.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
+				Constants.WSRM.SEQUENCE));
+		if (elem!=null)
+			elem.detach();
+		
 		toOMElement(header);
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java
Sun Oct  2 05:16:19 2005
@@ -16,6 +16,7 @@
  */
 package org.apache.sandesha2.wsrm;
 
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
@@ -46,9 +47,9 @@
 
 	private Identifier identifier;
 
-	private List acknowledgementRangeList;
+	private ArrayList acknowledgementRangeList;
 
-	private List nackList;
+	private ArrayList nackList;
 
 	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
 			Constants.SOAPVersion.DEFAULT).createOMNamespace(
@@ -58,8 +59,8 @@
 		sequenceAcknowledgementElement = SOAPAbstractFactory.getSOAPFactory(
 				Constants.SOAPVersion.DEFAULT).createOMElement(
 				Constants.WSRM.SEQUENCE_ACK, rmNamespace);
-		acknowledgementRangeList = new LinkedList();
-		nackList = new LinkedList();
+		acknowledgementRangeList = new ArrayList();
+		nackList = new ArrayList();
 	}
 
 	public OMElement getOMElement() throws OMException {
@@ -154,7 +155,7 @@
 		this.identifier = identifier;
 	}
 
-	public void setAckRanges(List acknowledgementRagngesList) {
+	public void setAckRanges(ArrayList acknowledgementRagngesList) {
 		acknowledgementRangeList = acknowledgementRagngesList;
 	}
 
@@ -187,6 +188,13 @@
 
 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
 		SOAPHeader header = envelope.getHeader();
+
+		//detach if already exist.
+		OMElement elem = header.getFirstChildWithName(new QName(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.SEQUENCE_ACK));
+		if (elem != null)
+			elem.detach();
+
 		toOMElement(header);
 	}
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java?rev=293097&r1=293096&r2=293097&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java Sun Oct
 2 05:16:19 2005
@@ -110,6 +110,13 @@
 
 	public void toSOAPEnvelope(SOAPEnvelope envelope) {
 		SOAPBody body = envelope.getBody();
+		
+		//detach if already exist.
+		OMElement elem = body.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
+				Constants.WSRM.TERMINATE_SEQUENCE));
+		if (elem!=null)
+			elem.detach();
+		
 		toOMElement(body);
 	}
 }



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


Mime
View raw message