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 ch...@apache.org on 2005/11/06 19:59:29 UTC

svn commit: r331136 [1/2] - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ handlers/ msgprocessors/ policy/ storage/inmemory/ util/ workers/ wsrm/

Author: chamikara
Date: Sun Nov  6 10:57:13 2005
New Revision: 331136

URL: http://svn.apache.org/viewcvs?rev=331136&view=rev
Log:
Added SOAP 1.2 capability. Now Sandesha2 handles SOAP versions more accurately. In the server side, the SOAP version of the response messages depend on the versions of respective request messages. In the client side, the SOAP version should be set by the client. 
sender.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
Had to change the RM elements to get the SOAPFactory as a parameter rather tham deciding it.  

Changed code to take Policy values from a dynamic policy bean. (filling this bean as to be done by a policy manager which is not yet complete).

RMClient can set AckRequested part depending on a requirement (not decided yet). The idintifier for this will be set by createSequenceResponseProcessor.

Many bug fixes and improvements.

Added:
    webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaDynamicProperties.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/policy/
    webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicyBean.java
Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SOAPAbstractFactory.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.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/AcksTo.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.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/Expires.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.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/SequenceFault.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceOffer.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/TerminateSequence.java

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Sun Nov  6 10:57:13 2005
@@ -17,6 +17,8 @@
 
 package org.apache.sandesha2;
 
+import org.apache.axis2.soap.SOAPConstants;
+
 
 
 /**
@@ -114,7 +116,10 @@
 	}
 
 	public interface WSP {
-		long RETRANSMISSION_INTERVAL = 15000;
+		long RETRANSMISSION_INTERVAL = 10000;
+		long ACKNOWLEDGEMENT_INTERVAL = 3000;
+		boolean EXPONENTION_BACKOFF = false;
+		long INACTIVITY_TIMEOUT_INTERVAL = 5000000;
 	}
 
 	public interface MessageTypes {
@@ -191,8 +196,6 @@
 		int v1_1 = 1;
 
 		int v1_2 = 2;
-
-		int DEFAULT = v1_1;
 	}
 
 	public interface QOS {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Sun Nov  6 10:57:13 2005
@@ -64,9 +64,13 @@
 	}
 
 	public void addSOAPEnvelope() throws AxisFault {
+		int SOAPVersion = Constants.SOAPVersion.v1_1;
+		
+		if (!msgContext.isSOAP11()) 
+			SOAPVersion = Constants.SOAPVersion.v1_2;
+		
 		if (msgContext.getEnvelope() == null) {
-			msgContext.setEnvelope(SOAPAbstractFactory.getSOAPFactory(
-					Constants.SOAPVersion.DEFAULT).getDefaultEnvelope());
+			msgContext.setEnvelope(SOAPAbstractFactory.getSOAPFactory(SOAPVersion).getDefaultEnvelope());
 		}
 
 		SOAPEnvelope envelope = msgContext.getEnvelope();

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaDynamicProperties.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaDynamicProperties.java?rev=331136&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaDynamicProperties.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/SandeshaDynamicProperties.java Sun Nov  6 10:57:13 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2004,2005 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;
+
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
+import org.apache.sandesha2.policy.RMPolicyBean;
+
+
+public class SandeshaDynamicProperties {
+
+	private String storageManagerImpl = Constants.STORAGE_MANAGER_IMPL;
+	private RMPolicyBean policyBean = null;
+	//private String SOAPVersionURI = null;
+	
+	public SandeshaDynamicProperties () {
+	
+		loadPolicyBeanFromConstants ();
+	}
+	
+	private void loadPolicyBeanFromConstants () {
+		//loading default properties. these will be overriden later (most of the time).
+		policyBean = new RMPolicyBean ();
+		policyBean.setAcknowledgementInterval(Constants.WSP.ACKNOWLEDGEMENT_INTERVAL);
+		policyBean.setRetransmissionInterval(Constants.WSP.RETRANSMISSION_INTERVAL);
+		policyBean.setExponentialBackoff(Constants.WSP.EXPONENTION_BACKOFF);
+		policyBean.setInactiveTimeoutInterval(Constants.WSP.INACTIVITY_TIMEOUT_INTERVAL);
+		
+//		if (Constants.SOAPVersion.DEFAULT==Constants.SOAPVersion.v1_1){
+//			SOAPVersionURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+//		}else {
+//			SOAPVersionURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+//		}
+		
+		//default is SOAP 1.1
+		//SOAPVersionURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+	}
+	
+	
+	
+	
+	
+	public RMPolicyBean getPolicyBean() {
+		return policyBean;
+	}
+	
+	public void setPolicyBean(RMPolicyBean policyBean) {
+		this.policyBean = policyBean;
+	}
+	
+//	public String getSOAPVersionURI() {
+//		return SOAPVersionURI;
+//	}
+//	
+//	public void setSOAPVersionURI(String versionURI) {
+//		SOAPVersionURI = versionURI;
+//	}
+	
+	public String getStorageManagerImpl() {
+		return storageManagerImpl;
+	}
+	
+	public void setStorageManagerImpl(String storageManagerImpl) {
+		this.storageManagerImpl = storageManagerImpl;
+	}
+}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java Sun Nov  6 10:57:13 2005
@@ -34,6 +34,11 @@
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.wsrm.Sequence;
 
+/**
+ * 
+ * @author chamikara
+ */
+
 public class SandeshaGlobalInHandler extends AbstractHandler {
 
 	public void invoke(MessageContext msgContext) throws AxisFault {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Sun Nov  6 10:57:13 2005
@@ -32,6 +32,11 @@
 import org.apache.sandesha2.util.MsgInitializer;
 import org.apache.sandesha2.util.SandeshaUtil;
 
+/**
+ * 
+ * @author chamikara
+ */
+
 public class SandeshaInHandler extends AbstractHandler {
 
 	public QName getName() {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Sun Nov  6 10:57:13 2005
@@ -25,13 +25,18 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.OperationContextFactory;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.ParameterImpl;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
+import org.apache.sandesha2.SandeshaDynamicProperties;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.storage.StorageManager;
@@ -46,6 +51,7 @@
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.util.SequenceManager;
+import org.apache.sandesha2.wsrm.AckRequested;
 import org.apache.sandesha2.wsrm.CreateSequence;
 import org.apache.sandesha2.wsrm.Identifier;
 import org.apache.sandesha2.wsrm.LastMessage;
@@ -54,6 +60,11 @@
 import org.apache.sandesha2.wsrm.SequenceOffer;
 import org.apache.wsdl.WSDLConstants;
 
+/**
+ * 
+ * @author chamikara
+ */
+
 public class SandeshaOutHandler extends AbstractHandler {
 
 	public void invoke(MessageContext msgCtx) throws AxisFault {
@@ -179,9 +190,21 @@
 
 		SequencePropertyBean outSeqBean = seqPropMgr.retrieve(tempSequenceId,
 				Constants.SequenceProperties.OUT_SEQUENCE_ID);
-
-		if ((messageNumber == 1) && (outSeqBean == null)) {
-			sendCreateSequence = true;
+		
+		if (messageNumber==1) {
+			if (outSeqBean==null) {
+				sendCreateSequence = true;
+			}
+			
+//			SandeshaDynamicProperties dynamicProperties = SandeshaUtil.getDynamicProperties();
+//			if (msgCtx.isSOAP11()) {
+//				dynamicProperties.setSOAPVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+//			}else {
+//				dynamicProperties.setSOAPVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
+//			}
+			
+			//TODO: set the policy bean
+			//dynamicProperties.setPolicyBean();
 		}
 
 		//if fist message - setup the sequence for the client side
@@ -204,7 +227,9 @@
 				seqPropMgr.insert(responseCreateSeqAdded);
 
 				String acksTo = (String) context.getProperty(Constants.AcksTo);
-
+				if (acksTo==null)
+					acksTo = Constants.WSA.NS_URI_ANONYMOUS;
+				
 				//If acksTo is not anonymous. Start the listner TODO: verify
 				if (!Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo)
 						&& !serverSide) {
@@ -225,6 +250,12 @@
 						if (acksToEPR != null)
 							acksTo = (String) acksToEPR.getAddress();
 					}
+				}else if (Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo)){
+					//set transport in.
+					Object trIn = msgCtx.getProperty(MessageContext.TRANSPORT_IN);
+					if (trIn==null) {
+					
+					}
 				}
 
 				addCreateSequenceMessage(rmMsgCtx, tempSequenceId, acksTo);
@@ -236,8 +267,7 @@
 
 		SOAPEnvelope env = rmMsgCtx.getSOAPEnvelope();
 		if (env == null) {
-			SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
-					Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
+			SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(env)).getDefaultEnvelope();
 			rmMsgCtx.setSOAPEnvelop(envelope);
 		}
 
@@ -433,6 +463,8 @@
 
 		MessageContext msg = rmMsg.getMessageContext();
 
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(rmMsg.getSOAPEnvelope()));
+		
 		if (rmMsg == null)
 			throw new SandeshaException("Message or reques message is null");
 
@@ -477,16 +509,39 @@
 		//				|| replyToEPR.getAddress() == "")
 		//			throw new SandeshaException("ReplyTo is not set correctly");
 
-		rmMsg.setTo(toEPR);
+		//Setting wsa:To to the replyTo value of the respective request message
+		//(instead of the replyTo of the CreateSequenceMessage)
+
+		String newToStr = null;
+
+		if (msg.isServerSide()) {
+			try {
+				MessageContext requestMsg = msg.getOperationContext()
+						.getMessageContext(
+								OperationContextFactory.MESSAGE_LABEL_IN_VALUE);
+				if (requestMsg != null) {
+					newToStr = requestMsg.getReplyTo().getAddress();
+				}
+			} catch (AxisFault e) {
+				throw new SandeshaException(e.getMessage());
+			}
+		}
+
+		if (newToStr != null)
+			rmMsg.setTo(new EndpointReference(newToStr));
+		else
+			rmMsg.setTo(toEPR);
+
 		if (replyToEPR != null)
 			rmMsg.setReplyTo(replyToEPR);
 
-		Sequence sequence = new Sequence();
+		Sequence sequence = new Sequence(factory);
 
-		MessageNumber msgNumber = new MessageNumber();
+		MessageNumber msgNumber = new MessageNumber(factory);
 		msgNumber.setMessageNumber(messageNumber);
 		sequence.setMessageNumber(msgNumber);
 
+		boolean lastMessage = false;
 		//setting last message
 		if (msg.isServerSide()) {
 			//server side
@@ -508,9 +563,10 @@
 				throw new SandeshaException("Request Sequence is null");
 
 			if (requestSequence.getLastMessage() != null) {
+				lastMessage = true;
 				//FIXME - This fails if request last message has more than one
 				// responses.
-				sequence.setLastMessage(new LastMessage());
+				sequence.setLastMessage(new LastMessage(factory));
 
 				//saving the last message no.
 				SequencePropertyBean lastOutMsgBean = new SequencePropertyBean(
@@ -522,11 +578,12 @@
 
 		} else {
 			//client side
-
+			
 			Object obj = msg.getSystemContext().getProperty(
 					Constants.LAST_MESSAGE);
 			if (obj != null && "true".equals(obj)) {
-				sequence.setLastMessage(new LastMessage());
+				lastMessage = true;
+				sequence.setLastMessage(new LastMessage(factory));
 				//saving the last message no.
 				SequencePropertyBean lastOutMsgBean = new SequencePropertyBean(
 						tempSequenceId,
@@ -536,22 +593,40 @@
 			}
 		}
 
+		AckRequested ackRequested = null;
+
+		//TODO do this based on policies.
+		boolean addAckRequested = false;
+//		if (!lastMessage)
+//			addAckRequested = true;
+
 		//setting the Sequnece id.
 		//Set send = true/false depending on the availability of the out
 		// sequence id.
+		String identifierStr = null;
 		if (outSequenceBean == null || outSequenceBean.getValue() == null) {
-			Identifier identifier = new Identifier();
-			identifier.setIndentifer(Constants.TEMP_SEQUENCE_ID);
-			sequence.setIdentifier(identifier);
+			identifierStr = Constants.TEMP_SEQUENCE_ID;
+			//			identifier.setIndentifer(Constants.TEMP_SEQUENCE_ID);
+			//			sequence.setIdentifier(identifier);
 
 		} else {
-			Identifier identifier = new Identifier();
-			identifier.setIndentifer((String) outSequenceBean.getValue());
-			sequence.setIdentifier(identifier);
+			identifierStr = (String) outSequenceBean.getValue();
+			//identifier.setIndentifer((String) outSequenceBean.getValue());
+		}
+		Identifier id1 = new Identifier(factory);
+		id1.setIndentifer(identifierStr);
+		sequence.setIdentifier(id1);
+		rmMsg.setMessagePart(Constants.MessageParts.SEQUENCE, sequence);
 
+		if (addAckRequested) {
+			ackRequested = new AckRequested(factory);
+			Identifier id2 = new Identifier(factory);
+			id2.setIndentifer(identifierStr);
+			ackRequested.setIdentifier(id2);
+			rmMsg.setMessagePart(Constants.MessageParts.ACK_REQUEST,
+					ackRequested);
 		}
 
-		rmMsg.setMessagePart(Constants.MessageParts.SEQUENCE, sequence);
 		try {
 			rmMsg.addSOAPEnvelope();
 		} catch (AxisFault e1) {

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Sun Nov  6 10:57:13 2005
@@ -33,6 +33,7 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
@@ -240,6 +241,8 @@
 			throws SandeshaException {
 
 		MessageContext msgCtx = rmMsgCtx.getMessageContext();
+		
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgCtx.getEnvelope()));
 		StorageManager storageManager = SandeshaUtil
 				.getSandeshaStorageManager(msgCtx.getSystemContext());
 		SequencePropertyBeanMgr seqPropMgr = storageManager
@@ -311,26 +314,40 @@
 		}
 
 		//Set new envelope
-		SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
+		SOAPEnvelope envelope = factory.getDefaultEnvelope();
 		try {
 			ackMsgCtx.setEnvelope(envelope);
 		} catch (AxisFault e3) {
 			throw new SandeshaException(e3.getMessage());
 		}
 
-		//FIXME set acksTo instead of ReplyTo
 		ackMsgCtx.setTo(acksTo);
 		ackMsgCtx.setReplyTo(msgCtx.getTo());
 		RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId);
 
+//		Object obj = rmMsgCtx.getMessageContext().getOperationContext().getProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN);
+		
+		
 		if (Constants.WSA.NS_URI_ANONYMOUS.equals(acksTo.getAddress())) {
 			AxisEngine engine = new AxisEngine(ackRMMsgCtx.getMessageContext()
 					.getSystemContext());
 
 			//set CONTEXT_WRITTEN since acksto is anonymous
+			if (rmMsgCtx.getMessageContext().getOperationContext()==null) {
+				//operation context will be null when doing in a GLOBAL handler.
+				try {
+					AxisOperation op = AxisOperationFactory.getAxisOperation(AxisOperationFactory.MEP_CONSTANT_IN_OUT);
+					OperationContext opCtx = new OperationContext (op);
+					rmMsgCtx.getMessageContext().setAxisOperation(op);
+					rmMsgCtx.getMessageContext().setOperationContext(opCtx);
+				} catch (AxisFault e2) {
+					throw new SandeshaException (e2.getMessage());
+				}
+			}
+			
 			rmMsgCtx.getMessageContext().getOperationContext().setProperty(
 					org.apache.axis2.Constants.RESPONSE_WRITTEN, "true");
+			
 			rmMsgCtx.getMessageContext().setProperty(Constants.ACK_WRITTEN,
 					"true");
 			try {
@@ -339,6 +356,9 @@
 				throw new SandeshaException(e1.getMessage());
 			}
 		} else {
+			rmMsgCtx.getMessageContext().getOperationContext().setProperty(
+					org.apache.axis2.Constants.RESPONSE_WRITTEN, "false");
+			
 			RetransmitterBeanMgr retransmitterBeanMgr = storageManager
 					.getRetransmitterBeanMgr();
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java Sun Nov  6 10:57:13 2005
@@ -154,8 +154,18 @@
 			seqPropMgr.insert(seqPropBean);
 			outMessage.setResponseWritten(true);
 
+			Object obj1 = createSeqMsg.getOperationContext().getProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN);
+
 			AxisEngine engine = new AxisEngine(context);
 			engine.send(outMessage);
+			
+			Object obj = createSeqMsg.getOperationContext().getProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN);
+			if (Constants.WSA.NS_URI_ANONYMOUS.equals(createSeqMsg.getReplyTo().getAddress())) {
+				//So that '202 OK' get sent instead of 200 OK.
+				createSeqMsg.getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,"true");
+			}else {
+				createSeqMsg.getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,"false");
+			}
 		} catch (AxisFault e1) {
 			throw new SandeshaException(e1.getMessage());
 		}

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Sun Nov  6 10:57:13 2005
@@ -30,8 +30,10 @@
 import org.apache.sandesha2.storage.beans.RetransmitterBean;
 import org.apache.sandesha2.storage.beans.SequencePropertyBean;
 import org.apache.sandesha2.util.MsgInitializer;
+import org.apache.sandesha2.util.SOAPAbstractFactory;
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.wsrm.Accept;
+import org.apache.sandesha2.wsrm.AckRequested;
 import org.apache.sandesha2.wsrm.CreateSequenceResponse;
 import org.apache.sandesha2.wsrm.Identifier;
 import org.apache.sandesha2.wsrm.Sequence;
@@ -40,6 +42,8 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.soap.SOAPFactory;
+
 import java.util.Iterator;
 import javax.xml.namespace.QName;
 
@@ -47,6 +51,8 @@
 	public void processMessage(RMMsgContext createSeqResponseRMMsgCtx)
 			throws SandeshaException {
 
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(createSeqResponseRMMsgCtx.getSOAPEnvelope()));
+		
 		//Processing for ack if any
 		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) createSeqResponseRMMsgCtx
 				.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
@@ -153,10 +159,18 @@
 			if (sequencePart == null)
 				throw new SandeshaException("Sequence part is null");
 
-			Identifier identifier = new Identifier();
+			Identifier identifier = new Identifier(factory);
 			identifier.setIndentifer(newOutSequenceId);
 
 			sequencePart.setIdentifier(identifier);
+			
+			AckRequested ackRequestedPart = (AckRequested) applicaionRMMsg.getMessagePart(Constants.MessageParts.ACK_REQUEST);
+			if (ackRequestedPart!=null) {
+				Identifier id1 = new Identifier (factory);
+				id1.setIndentifer(newOutSequenceId);
+				ackRequestedPart.setIdentifier(id1);
+			}
+			
 			try {
 				applicaionRMMsg.addSOAPEnvelope();
 			} catch (AxisFault e) {

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicyBean.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicyBean.java?rev=331136&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicyBean.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/policy/RMPolicyBean.java Sun Nov  6 10:57:13 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2004,2005 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.policy;
+
+/**
+ * @author Sanka Samaranayake (sanka@apache.org)
+ */
+
+public class RMPolicyBean {
+    private long inactiveTimeoutInterval = -1l;
+    private long acknowledgementInterval = -1l;
+    private long retransmissionInterval = -1l;
+    private boolean exponentialBackoff = false;
+    
+    
+    public RMPolicyBean() {
+        
+    }
+    
+    public long getInactiveTimeoutInterval() {
+        return inactiveTimeoutInterval;
+    }
+    
+    public long getAcknowledgementInaterval() {
+        return acknowledgementInterval;
+    }
+    
+    public long getRetransmissionInterval() {
+        return retransmissionInterval;
+    }
+    
+    public boolean getExponentialBackoff() {
+        return exponentialBackoff;
+    }
+    
+    public void setExponentialBackoff(boolean exponentialBackoff) {
+        this.exponentialBackoff = exponentialBackoff;        
+    }
+    
+    public void setRetransmissionInterval(long retransmissionInterval) {
+        this.retransmissionInterval = retransmissionInterval;
+    }
+    
+    public void setInactiveTimeoutInterval(long inactiveTimeoutInterval) {
+        this.inactiveTimeoutInterval = inactiveTimeoutInterval;
+    }
+    
+    public void setAcknowledgementInterval(long acknowledgementInterval) {
+        this.acknowledgementInterval = acknowledgementInterval;
+    }
+    
+    
+}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/storage/inmemory/InMemoryRetransmitterBeanMgr.java Sun Nov  6 10:57:13 2005
@@ -19,6 +19,7 @@
 import java.sql.ResultSet;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
 
@@ -119,7 +120,35 @@
 			}
 		}
 
-		return beans;
+		//temp hack for microsoft
+		sort (beans);
+		
+		return sort(beans);
+	}
+	
+	private ArrayList sort (ArrayList beans) {
+		ArrayList newBeans = new ArrayList ();
+		HashMap tempHash = new HashMap ();
+		
+		Iterator iter = beans.iterator();
+		while (iter.hasNext()){
+			RetransmitterBean bean = (RetransmitterBean) iter.next();
+			if (bean.getMessageNumber()>0)
+				tempHash.put(new Long (bean.getMessageNumber()),bean);
+			else
+				newBeans.add(bean);
+		}
+		
+		long tempNo = 1;
+		RetransmitterBean tempBean = (RetransmitterBean) tempHash.get(new Long (tempNo));
+		while (tempBean!=null) {
+			newBeans.add(tempBean);
+			tempNo++;
+			tempBean = (RetransmitterBean) tempHash.get(new Long (tempNo));
+		}
+		
+
+		return newBeans;
 	}
 
 	public boolean update(RetransmitterBean bean) {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/FaultMgr.java Sun Nov  6 10:57:13 2005
@@ -276,6 +276,7 @@
 	public RMMsgContext getFault(int type, MessageContext msgCtx)
 			throws SandeshaException {
 
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgCtx.getEnvelope()));
 		FaultData data = new FaultData();
 
 		switch (type) {
@@ -308,8 +309,8 @@
 		newMsgCtx.setServiceContext(msgCtx.getServiceContext());
 		RMMsgContext newRMMsgCtx = new RMMsgContext(newMsgCtx);
 
-		SequenceFault seqFault = new SequenceFault();
-		FaultCode faultCode = new FaultCode();
+		SequenceFault seqFault = new SequenceFault(factory);
+		FaultCode faultCode = new FaultCode(factory);
 		faultCode.setFaultCode(data.code);
 		seqFault.setFaultCode(faultCode);
 
@@ -344,7 +345,7 @@
 			throws SandeshaException {
 
 		SOAPFactory factory = SOAPAbstractFactory
-				.getSOAPFactory(Constants.SOAPVersion.v1_1);
+				.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgCtx.getEnvelope()));
 		SOAPEnvelope faultMsgEnvelope = factory.getDefaultFaultEnvelope();
 
 		SOAPFault fault;
@@ -398,7 +399,8 @@
 			throws SandeshaException {
 
 		SOAPFactory factory = SOAPAbstractFactory
-				.getSOAPFactory(Constants.SOAPVersion.v1_2);
+		.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgCtx.getEnvelope()));
+		
 		SOAPEnvelope envelope = factory.getDefaultFaultEnvelope();
 
 		SOAPFault fault = envelope.getBody().getFault();

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/RMMsgCreator.java Sun Nov  6 10:57:13 2005
@@ -34,6 +34,7 @@
 import org.apache.axis2.description.AxisServiceGroup;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
@@ -67,6 +68,8 @@
 		if (context == null)
 			throw new SandeshaException("Configuration Context is null");
 
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion ( applicationMsgContext.getEnvelope()));
+		
 		StorageManager storageManager = SandeshaUtil
 				.getSandeshaStorageManager(context);
 		SequencePropertyBeanMgr seqPropMgr = storageManager
@@ -97,6 +100,8 @@
 					.getAxisOperation();
 			AxisOperation createSeqOperationDesc = AxisOperationFactory
 					.getOperetionDescription(AxisOperationFactory.MEP_URI_OUT_IN);
+			
+			createSeqOperationDesc.setName(new QName ("CreateSequenceOperation"));
 			if (appMsgOperationDesc != null) {
 				createSeqOperationDesc.setPhasesOutFlow(appMsgOperationDesc
 						.getPhasesOutFlow());
@@ -114,6 +119,7 @@
 			//TODO set a suitable ope. description
 			OperationContext createSeqOpContext = new OperationContext(
 					createSeqmsgContext.getAxisOperation());
+			
 			createSeqmsgContext.setOperationContext(createSeqOpContext);
 			createSeqOpContext.addMessageContext(createSeqmsgContext);
 			//registering opearion context
@@ -122,8 +128,8 @@
 							createSeqOpContext);
 
 			//Setting a new SOAP Envelop.
-			SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
-					Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
+			
+			SOAPEnvelope envelope = factory.getDefaultEnvelope();
 
 			createSeqmsgContext.setEnvelope(envelope);
 			//			createSeqOpContext.addMessageContext(createSeqmsgContext);
@@ -137,14 +143,14 @@
 
 		RMMsgContext createSeqRMMsg = new RMMsgContext(createSeqmsgContext);
 
-		CreateSequence createSequencePart = new CreateSequence();
+		CreateSequence createSequencePart = new CreateSequence(factory);
 
 		//Adding sequence offer - if present
 		String offeredSequence = (String) context
 				.getProperty(Constants.OFFERED_SEQUENCE_ID);
 		if (offeredSequence != null && !"".equals(offeredSequence)) {
-			SequenceOffer offerPart = new SequenceOffer();
-			Identifier identifier = new Identifier();
+			SequenceOffer offerPart = new SequenceOffer(factory);
+			Identifier identifier = new Identifier(factory);
 			identifier.setIndentifer(offeredSequence);
 			offerPart.setIdentifier(identifier);
 			createSequencePart.setSequenceOffer(offerPart);
@@ -186,7 +192,7 @@
 			createSeqRMMsg.setReplyTo(replyToEPR);
 
 		//FIXME - Give user a seperate way to set acksTo (client side)
-		createSequencePart.setAcksTo(new AcksTo(new Address(acksToEPR)));
+		createSequencePart.setAcksTo(new AcksTo(new Address(acksToEPR,factory),factory));
 
 		createSeqRMMsg.setMessagePart(Constants.MessageParts.CREATE_SEQ,
 				createSequencePart);
@@ -228,6 +234,8 @@
 		if (terminateMessage == null)
 			throw new SandeshaException("MessageContext is null");
 
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion ( referenceMessage.getEnvelope()));
+
 		MessageInformationHeaders newMessageInfoHeaders = new MessageInformationHeaders();
 		terminateMessage.setMessageInformationHeaders(newMessageInfoHeaders);
 		terminateMessage.setMessageID(SandeshaUtil.getUUID());
@@ -276,12 +284,11 @@
 			throw new SandeshaException(e.getMessage());
 		}
 
-		SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
+		SOAPEnvelope envelope = factory.getDefaultEnvelope();
 		terminateRMMessage.setSOAPEnvelop(envelope);
 
-		TerminateSequence terminateSequencePart = new TerminateSequence();
-		Identifier identifier = new Identifier();
+		TerminateSequence terminateSequencePart = new TerminateSequence(factory);
+		Identifier identifier = new Identifier(factory);
 		identifier.setIndentifer(sequenceId);
 		terminateSequencePart.setIdentifier(identifier);
 		terminateRMMessage.setMessagePart(Constants.MessageParts.TERMINATE_SEQ,
@@ -294,13 +301,15 @@
 			RMMsgContext createSeqMessage, MessageContext outMessage,
 			String newSequenceID) throws AxisFault {
 
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion ( createSeqMessage.getSOAPEnvelope()));
+		
 		IOMRMElement messagePart = createSeqMessage
 				.getMessagePart(Constants.MessageParts.CREATE_SEQ);
 		CreateSequence cs = (CreateSequence) messagePart;
 
-		CreateSequenceResponse response = new CreateSequenceResponse();
+		CreateSequenceResponse response = new CreateSequenceResponse(factory);
 
-		Identifier identifier = new Identifier();
+		Identifier identifier = new Identifier(factory);
 		identifier.setIndentifer(newSequenceID);
 
 		response.setIdentifier(identifier);
@@ -312,10 +321,10 @@
 			//TODO do a better validation for the offered out sequence id.
 			if (outSequenceId != null && !"".equals(outSequenceId)) {
 
-				Accept accept = new Accept();
+				Accept accept = new Accept(factory);
 				EndpointReference acksToEPR = createSeqMessage.getTo();
-				AcksTo acksTo = new AcksTo();
-				Address address = new Address();
+				AcksTo acksTo = new AcksTo(factory);
+				Address address = new Address(factory);
 				address.setEpr(acksToEPR);
 				acksTo.setAddress(address);
 				accept.setAcksTo(acksTo);
@@ -324,8 +333,7 @@
 
 		}
 
-		SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
+		SOAPEnvelope envelope = factory.getDefaultEnvelope();
 		response.toOMElement(envelope.getBody());
 		outMessage.setWSAAction(Constants.WSRM.Actions.ACTION_CREATE_SEQUENCE_RESPONSE);
 		outMessage.setSoapAction(Constants.WSRM.Actions.SOAP_ACTION_CREATE_SEQUENCE_RESPONSE);
@@ -348,16 +356,18 @@
 	//Adds a ack message to the following message.
 	public static void addAckMessage(RMMsgContext applicationMsg,
 			String sequenceId) throws SandeshaException {
+		
+		SOAPFactory factory = SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion ( applicationMsg.getSOAPEnvelope()));
+
 		SOAPEnvelope envelope = applicationMsg.getSOAPEnvelope();
 		if (envelope == null) {
-			SOAPEnvelope newEnvelope = SOAPAbstractFactory.getSOAPFactory(
-					Constants.SOAPVersion.DEFAULT).getDefaultEnvelope();
+			SOAPEnvelope newEnvelope = factory.getDefaultEnvelope();
 			applicationMsg.setSOAPEnvelop(newEnvelope);
 		}
 		envelope = applicationMsg.getSOAPEnvelope();
 
-		SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement();
-		Identifier id = new Identifier();
+		SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement(factory);
+		Identifier id = new Identifier(factory);
 		id.setIndentifer(sequenceId);
 		sequenceAck.setIdentifier(id);
 
@@ -373,7 +383,7 @@
 		String msgNoList = (String) seqBean.getValue();
 
 		AcknowledgementRange[] ackRangeArr = SandeshaUtil
-				.getAckRangeArray(msgNoList);
+				.getAckRangeArray(msgNoList,factory);
 
 		int length = ackRangeArr.length;
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/util/SOAPAbstractFactory.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/util/SOAPAbstractFactory.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SOAPAbstractFactory.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SOAPAbstractFactory.java Sun Nov  6 10:57:13 2005
@@ -18,6 +18,8 @@
 package org.apache.sandesha2.util;
 
 import org.apache.axis2.om.OMAbstractFactory;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 
@@ -31,11 +33,11 @@
 public class SOAPAbstractFactory {
 
 	public static SOAPFactory getSOAPFactory (int SOAPVersion) {
+		
 		if (SOAPVersion==Constants.SOAPVersion.v1_1)
 			return OMAbstractFactory.getSOAP11Factory();
-		else if(SOAPVersion==Constants.SOAPVersion.v1_2)
+		else 
 			return OMAbstractFactory.getSOAP12Factory();
-		else
-			return null;
+		
 	}
 }

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Sun Nov  6 10:57:13 2005
@@ -33,6 +33,8 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.impl.llom.builder.StAXBuilder;
 import org.apache.axis2.om.impl.llom.builder.StAXOMBuilder;
+import org.apache.axis2.soap.SOAP11Constants;
+import org.apache.axis2.soap.SOAP12Constants;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.impl.llom.builder.StAXSOAPModelBuilder;
@@ -43,6 +45,7 @@
 import org.apache.commons.httpclient.NameValuePair;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.SandeshaDynamicProperties;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.storage.StorageManager;
 import org.apache.sandesha2.workers.InOrderInvoker;
@@ -60,13 +63,14 @@
 	private static StorageManager storageManager = null;
 	private static Sender sender = new Sender();
 	private static InOrderInvoker invoker = new InOrderInvoker ();
-
+	private static SandeshaDynamicProperties dynamicProperties = null;
+	
 	public static String getUUID() {
 		String uuid = "uuid:" + UUIDGenerator.getUUID();
 		return uuid;
 	}
 
-	public static AcknowledgementRange[] getAckRangeArray(String msgNoStr) {
+	public static AcknowledgementRange[] getAckRangeArray(String msgNoStr,SOAPFactory factory) {
 		String[] msgNoStrs = msgNoStr.split(",");
 		long[] msgNos = getLongArr(msgNoStrs);
 
@@ -92,7 +96,7 @@
 				continue;
 			}
 
-			AcknowledgementRange ackRange = new AcknowledgementRange();
+			AcknowledgementRange ackRange = new AcknowledgementRange(factory);
 			ackRange.setLowerValue(lower);
 			ackRange.setUpperValue(temp);
 			ackRanges.add(ackRange);
@@ -102,7 +106,7 @@
 
 		}
 
-		AcknowledgementRange ackRange = new AcknowledgementRange();
+		AcknowledgementRange ackRange = new AcknowledgementRange(factory);
 		ackRange.setLowerValue(lower);
 		ackRange.setUpperValue(temp);
 		ackRanges.add(ackRange);
@@ -467,5 +471,30 @@
 			System.out.println(e.getMessage());
 			throw new SandeshaException (e.getMessage());
 		} 
+	}
+	
+	public static SandeshaDynamicProperties getDynamicProperties () {
+		if (dynamicProperties==null) {
+			loadDymanicProperties ();
+		}
+		
+		return dynamicProperties;
+	}
+	
+	private static void loadDymanicProperties () {
+		dynamicProperties = new SandeshaDynamicProperties ();
+		
+		//TODO: override properties from the sandesha-config.xml
+		
+	}
+	
+	public static int getSOAPVersion (SOAPEnvelope envelope) throws SandeshaException {
+		String namespaceName = envelope.getNamespace().getName();
+		if (namespaceName.equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) 
+			return Constants.SOAPVersion.v1_1;
+		else if (namespaceName.equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+			return Constants.SOAPVersion.v1_2;
+		else
+			throw new SandeshaException ("Unknown SOAP version");
 	}
 }

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Sun Nov  6 10:57:13 2005
@@ -70,6 +70,8 @@
 					try {
 						RMMsgContext rmMsgCtx = MsgInitializer
 								.initializeMessage(msgCtx);
+						
+						
 						updateMessage(msgCtx);
 
 						Object debug = context
@@ -84,8 +86,8 @@
 
 						new AxisEngine(context).send(msgCtx);
 
-						//if (!msgCtx.isServerSide())
-						checkForSyncResponses(msgCtx);
+						if (!msgCtx.isServerSide())
+							checkForSyncResponses(msgCtx);
 
 					} catch (AxisFault e1) {
 						e1.printStackTrace();
@@ -163,6 +165,7 @@
 		boolean responsePresent = (msgCtx
 				.getProperty(MessageContext.TRANSPORT_IN) != null);
 
+	
 		if (responsePresent) {
 			//create the response
 			MessageContext response = new MessageContext(msgCtx
@@ -201,6 +204,7 @@
 						.getEnvelope().getNamespace().getName());
 			} catch (AxisFault e) {
 				//TODO: change to log.debug
+				e.printStackTrace();
 			}
 
 			if (resenvelope != null) {

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Accept.java Sun Nov  6 10:57:13 2005
@@ -20,6 +20,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -33,14 +34,16 @@
 	private OMElement acceptElement;
 
 	private AcksTo acksTo;
+	
+	private SOAPFactory factory;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public Accept() {
-		acceptElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNamespace = null; 
+
+	public Accept(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		acceptElement = factory.createOMElement(
 				Constants.WSRM.ACCEPT, rmNamespace);
 	}
 
@@ -56,11 +59,10 @@
 			throw new OMException(
 					"Passed element does not contain an Accept part");
 
-		acksTo = new AcksTo();
+		acksTo = new AcksTo(factory);
 		acksTo.fromOMElement(acceptPart);
 
-		acceptElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		acceptElement = factory.createOMElement(
 				Constants.WSRM.ACCEPT, rmNamespace);
 
 		return this;
@@ -79,8 +81,7 @@
 		acksTo.toOMElement(acceptElement);
 		element.addChild(acceptElement);
 
-		acceptElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		acceptElement = factory.createOMElement(
 				Constants.WSRM.ACCEPT, rmNamespace);
 
 		return element;

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AckRequested.java Sun Nov  6 10:57:13 2005
@@ -22,6 +22,7 @@
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.SOAPHeader;
 import org.apache.axis2.soap.SOAPHeaderBlock;
 import org.apache.sandesha2.Constants;
@@ -39,14 +40,16 @@
 	private Identifier identifier;
 
 	private MessageNumber messageNumber;
+	
+	private SOAPFactory factory;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public AckRequested() {
-		ackRequestedElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNamespace = null;
+
+	public AckRequested(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		ackRequestedElement = factory.createOMElement(
 				Constants.WSRM.ACK_REQUESTED, rmNamespace);
 	}
 
@@ -67,19 +70,18 @@
 			throw new OMException(
 					"the passed element does not contain an ack requested part");
 
-		identifier = new Identifier();
+		identifier = new Identifier(factory);
 		identifier.fromOMElement(ackReqPart);
 
 		OMElement msgNoPart = ackReqPart.getFirstChildWithName(new QName(
 				Constants.WSRM.NS_URI_RM, Constants.WSRM.MSG_NUMBER));
 
 		if (msgNoPart != null) {
-			messageNumber = new MessageNumber();
+			messageNumber = new MessageNumber(factory);
 			messageNumber.fromOMElement(ackReqPart);
 		}
 
-		ackRequestedElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		ackRequestedElement = factory.createOMElement(
 				Constants.WSRM.ACK_REQUESTED, rmNamespace);
 
 		return this;
@@ -106,8 +108,7 @@
 			messageNumber.toOMElement(ackReqHdrBlock);
 		}
 
-		ackRequestedElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		ackRequestedElement = factory.createOMElement(
 				Constants.WSRM.ACK_REQUESTED, rmNamespace);
 
 		return 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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcknowledgementRange.java Sun Nov  6 10:57:13 2005
@@ -22,6 +22,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -37,14 +38,16 @@
 	private long upperValue;
 
 	private long lowerValue;
+	
+	private SOAPFactory factory;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public AcknowledgementRange() {
-		acknowledgementRangeElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNamespace = null;
+
+	public AcknowledgementRange(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		acknowledgementRangeElement = factory.createOMElement(
 				Constants.WSRM.ACK_RANGE, rmNamespace);
 	}
 
@@ -76,8 +79,7 @@
 					"The ack range does not have proper long values for Upper and Lower attributes");
 		}
 
-		acknowledgementRangeElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		acknowledgementRangeElement = factory.createOMElement(
 				Constants.WSRM.ACK_RANGE, rmNamespace);
 
 		return this;
@@ -94,11 +96,9 @@
 			throw new OMException(
 					"Cant set Ack Range part since Upper or Lower is not set to the correct value");
 
-		OMAttribute lowerAttrib = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMAttribute(
+		OMAttribute lowerAttrib = factory.createOMAttribute(
 				Constants.WSRM.LOWER, null, Long.toString(lowerValue));
-		OMAttribute upperAttrib = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMAttribute(
+		OMAttribute upperAttrib = factory.createOMAttribute(
 				Constants.WSRM.UPPER, null, Long.toString(upperValue));
 
 		acknowledgementRangeElement.addAttribute(lowerAttrib);
@@ -106,8 +106,7 @@
 
 		sequenceAckElement.addChild(acknowledgementRangeElement);
 
-		acknowledgementRangeElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		acknowledgementRangeElement = factory.createOMElement(
 				Constants.WSRM.ACK_RANGE, rmNamespace);
 
 		return sequenceAckElement;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/AcksTo.java Sun Nov  6 10:57:13 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -38,18 +39,20 @@
 
 	//private OMElement addressElement;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public AcksTo() {
-		acksToElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	private SOAPFactory factory;
+	
+	OMNamespace rmNamespace = null;
+
+	public AcksTo(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		acksToElement = factory.createOMElement(
 				Constants.WSRM.ACKS_TO, rmNamespace);
 	}
 	
-	public AcksTo (Address address) {
-		this ();
+	public AcksTo (Address address,SOAPFactory factory) {
+		this (factory);
 		this.address = address;
 	}
 
@@ -65,11 +68,10 @@
 			throw new OMException(
 					"Passed element does not contain an acksTo part");
 
-		address = new Address();
+		address = new Address(factory);
 		address.fromOMElement(acksToPart);
 
-		acksToElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		acksToElement = factory.createOMElement(
 				Constants.WSRM.ACKS_TO, rmNamespace);
 
 		return this;
@@ -88,8 +90,7 @@
 		address.toOMElement(acksToElement);
 		element.addChild(acksToElement);
 
-		acksToElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		acksToElement =factory.createOMElement(
 				Constants.WSRM.ACKS_TO, rmNamespace);
 
 		return element;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Address.java Sun Nov  6 10:57:13 2005
@@ -12,6 +12,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -26,20 +27,21 @@
 	EndpointReference epr = null;
 
 	OMElement addressElement;
+	
+	SOAPFactory factory;
+
+	OMNamespace rmNamespace = null;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT)
-			.createOMNamespace(Constants.WSA.NS_URI_ADDRESSING,
-					Constants.WSA.NS_PREFIX_ADDRESSING);
-
-	public Address() {
-		addressElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	public Address(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(Constants.WSA.NS_URI_ADDRESSING,
+				Constants.WSA.NS_PREFIX_ADDRESSING);
+		addressElement = factory.createOMElement(
 				Constants.WSA.ADDRESS, rmNamespace);
 	}
 	
-	public Address (EndpointReference epr) {
-		this();
+	public Address (EndpointReference epr,SOAPFactory factory) {
+		this(factory);
 		this.epr = epr;
 	}
 
@@ -57,8 +59,7 @@
 
 		addressElement = addressPart;
 		epr = new EndpointReference(addressText);
-		addressElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		addressElement = factory.createOMElement(
 				Constants.WSA.ADDRESS, rmNamespace);
 		return this;
 
@@ -80,8 +81,7 @@
 		addressElement.setText(epr.getAddress());
 		element.addChild(addressElement);
 
-		addressElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		addressElement = factory.createOMElement(
 				Constants.WSA.ADDRESS, rmNamespace);
 
 		return element;

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequence.java Sun Nov  6 10:57:13 2005
@@ -23,6 +23,7 @@
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -40,21 +41,23 @@
 	private Expires expires = null;
 
 	private SequenceOffer sequenceOffer = null;
+	
+	private SOAPFactory factory;
 
 	//private SequritytokenReference;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public CreateSequence() {
-		createSequenceElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNamespace = null;
+
+	public CreateSequence(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		createSequenceElement = factory.createOMElement(
 				Constants.WSRM.CREATE_SEQUENCE, rmNamespace);
 	}
 	
-	public CreateSequence (AcksTo acksTo) {
-		this ();
+	public CreateSequence (AcksTo acksTo,SOAPFactory factory) {
+		this (factory);
 		this.acksTo = acksTo;
 	}
 
@@ -71,18 +74,17 @@
 			throw new OMException(
 					"Create sequence is not present in the passed element");
 
-		createSequenceElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		createSequenceElement = factory.createOMElement(
 				Constants.WSRM.CREATE_SEQUENCE, rmNamespace);
 
-		acksTo = new AcksTo();
+		acksTo = new AcksTo(factory);
 		acksTo.fromOMElement(createSequencePart);
 
 		OMElement offerPart = createSequencePart
 				.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
 						Constants.WSRM.SEQUENCE_OFFER));
 		if (offerPart != null) {
-			sequenceOffer = new SequenceOffer();
+			sequenceOffer = new SequenceOffer(factory);
 			sequenceOffer.fromOMElement(createSequencePart);
 		}
 
@@ -90,7 +92,7 @@
 				.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
 						Constants.WSRM.EXPIRES));
 		if (expiresPart != null) {
-			expires = new Expires();
+			expires = new Expires(factory);
 			expires.fromOMElement(createSequencePart);
 		}
 
@@ -120,8 +122,7 @@
 
 		soapBody.addChild(createSequenceElement);
 
-		createSequenceElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		createSequenceElement = factory.createOMElement(
 				Constants.WSRM.CREATE_SEQUENCE, rmNamespace);
 		return soapBody;
 	}

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/CreateSequenceResponse.java Sun Nov  6 10:57:13 2005
@@ -23,6 +23,7 @@
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -40,14 +41,16 @@
 	private Accept accept;
 
 	private Expires expires;
+	
+	SOAPFactory factory;
 
-	OMNamespace createSeqResNoNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public CreateSequenceResponse() {
-		createSequenceResponseElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace createSeqResNoNamespace = null;
+
+	public CreateSequenceResponse(SOAPFactory factory) {
+		this.factory = factory;
+		createSeqResNoNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		createSequenceResponseElement = factory.createOMElement(
 				Constants.WSRM.CREATE_SEQUENCE_RESPONSE,
 				createSeqResNoNamespace);
 	}
@@ -71,19 +74,18 @@
 			throw new OMException(
 					"The passed element does not contain a create seqence response part");
 
-		createSequenceResponseElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		createSequenceResponseElement = factory.createOMElement(
 				Constants.WSRM.CREATE_SEQUENCE_RESPONSE,
 				createSeqResNoNamespace);
 
-		identifier = new Identifier();
+		identifier = new Identifier(factory);
 		identifier.fromOMElement(createSeqResponsePart);
 
 		OMElement expiresPart = createSeqResponsePart
 				.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
 						Constants.WSRM.EXPIRES));
 		if (expiresPart != null) {
-			expires = new Expires();
+			expires = new Expires(factory);
 			expires.fromOMElement(createSeqResponsePart);
 		}
 
@@ -91,7 +93,7 @@
 				.getFirstChildWithName(new QName(Constants.WSRM.NS_URI_RM,
 						Constants.WSRM.ACCEPT));
 		if (acceptPart != null) {
-			accept = new Accept();
+			accept = new Accept(factory);
 			accept.fromOMElement(createSeqResponsePart);
 		}
 
@@ -125,8 +127,7 @@
 
 		SOAPBody.addChild(createSequenceResponseElement);
 
-		createSequenceResponseElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		createSequenceResponseElement = factory.createOMElement(
 				Constants.WSRM.CREATE_SEQUENCE_RESPONSE,
 				createSeqResNoNamespace);
 

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Expires.java Sun Nov  6 10:57:13 2005
@@ -22,6 +22,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -33,17 +34,19 @@
 
 public class Expires implements IOMRMElement {
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	SOAPFactory factory;
+	
+	OMNamespace rmNamespace = null;
 
 	OMElement expiresElement = null;
 
 	String duration = null;
 
-	public Expires() {
-		expiresElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	public Expires(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		expiresElement = factory.createOMElement(
 				Constants.WSRM.EXPIRES, rmNamespace);
 	}
 
@@ -57,8 +60,7 @@
 		if (expiresText == null || expiresText == "")
 			throw new OMException("The duration value is not valid");
 
-		expiresElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		expiresElement = factory.createOMElement(
 				Constants.WSRM.EXPIRES, rmNamespace);
 
 		duration = expiresText;
@@ -80,8 +82,7 @@
 		expiresElement.setText(duration);
 		element.addChild(expiresElement);
 
-		expiresElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		expiresElement = factory.createOMElement(
 				Constants.WSRM.EXPIRES, rmNamespace);
 
 		return element;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/FaultCode.java Sun Nov  6 10:57:13 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -35,14 +36,16 @@
 	private OMElement faultCodeElement;
 
 	String faultCode = null;
+	
+	SOAPFactory factory;
 
-	OMNamespace rmNameSpace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public FaultCode() {
-		faultCodeElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNameSpace = null;
+
+	public FaultCode(SOAPFactory factory) {
+		this.factory = factory;
+		rmNameSpace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		faultCodeElement = factory.createOMElement(
 				Constants.WSRM.FAULT_CODE, rmNameSpace);
 	}
 
@@ -66,8 +69,7 @@
 
 		this.faultCode = faultCodePart.getText();
 
-		faultCodeElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		faultCodeElement = factory.createOMElement(
 				Constants.WSRM.FAULT_CODE, rmNameSpace);
 
 		return sequenceFault;

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Identifier.java Sun Nov  6 10:57:13 2005
@@ -27,6 +27,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -36,14 +37,16 @@
 
 	private String identifier = null;
 
-	OMNamespace wsuNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public Identifier() {
-		identifierElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
-				Constants.WSRM.IDENTIFIER, wsuNamespace);
+	OMNamespace wsrmNamespace = null;
+
+	private SOAPFactory factory;
+	
+	public Identifier(SOAPFactory factory) {
+		this.factory = factory;
+		wsrmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		identifierElement = factory.createOMElement(
+				Constants.WSRM.IDENTIFIER, wsrmNamespace);
 	}
 
 	public void setIndentifer(String identifier) {
@@ -65,9 +68,8 @@
 		if (identifierPart == null)
 			throw new OMException(
 					"The parsed element does not contain an identifier part");
-		identifierElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
-				Constants.WSRM.IDENTIFIER, wsuNamespace);
+		identifierElement = factory.createOMElement(
+				Constants.WSRM.IDENTIFIER, wsrmNamespace);
 
 		String identifierText = identifierPart.getText();
 		if (identifierText == null || identifierText == "")
@@ -86,9 +88,8 @@
 		identifierElement.setText(identifier);
 		element.addChild(identifierElement);
 
-		identifierElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
-				Constants.WSRM.IDENTIFIER, wsuNamespace);
+		identifierElement = factory.createOMElement(
+				Constants.WSRM.IDENTIFIER, wsrmNamespace);
 
 		return element;
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/LastMessage.java Sun Nov  6 10:57:13 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -34,14 +35,16 @@
 
 	private OMElement lastMessageElement;
 
-	OMNamespace lastMsgNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public LastMessage() {
-		lastMessageElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
-				Constants.WSRM.LAST_MSG, lastMsgNamespace);
+	OMNamespace rmNamespace = null;
+	
+	SOAPFactory factory;
+
+	public LastMessage(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		lastMessageElement = factory.createOMElement(
+				Constants.WSRM.LAST_MSG, rmNamespace);
 	}
 
 	public OMElement getOMElement() throws OMException {
@@ -55,9 +58,8 @@
 			throw new OMException(
 					"The passed element does not contain a Last Message part");
 
-		lastMessageElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
-				Constants.WSRM.LAST_MSG, lastMsgNamespace);
+		lastMessageElement = factory.createOMElement(
+				Constants.WSRM.LAST_MSG, rmNamespace);
 
 		return this;
 	}
@@ -69,9 +71,8 @@
 
 		sequenceElement.addChild(lastMessageElement);
 
-		lastMessageElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
-				Constants.WSRM.LAST_MSG, lastMsgNamespace);
+		lastMessageElement = factory.createOMElement(
+				Constants.WSRM.LAST_MSG, rmNamespace);
 
 		return sequenceElement;
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/MessageNumber.java Sun Nov  6 10:57:13 2005
@@ -21,6 +21,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -35,11 +36,14 @@
 	private long messageNumber;
 	private OMElement messageNoElement;
 	
-	OMNamespace msgNoNamespace =
-		SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	OMNamespace rmNamespace = null;
 	
-	public MessageNumber(){
-		messageNoElement = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMElement(Constants.WSRM.MSG_NUMBER,msgNoNamespace);
+	SOAPFactory factory;
+	
+	public MessageNumber(SOAPFactory factory){
+		this.factory = factory;
+	    rmNamespace = factory.createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		messageNoElement = factory.createOMElement(Constants.WSRM.MSG_NUMBER,rmNamespace);
 	}
 	
 	public long getMessageNumber(){
@@ -55,7 +59,7 @@
 		if (msgNumberPart==null)
 			throw new OMException ("The passed sequnce element does not contain a message number part");
 		
-		messageNoElement = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMElement(Constants.WSRM.MSG_NUMBER,msgNoNamespace);
+		messageNoElement = factory.createOMElement(Constants.WSRM.MSG_NUMBER,rmNamespace);
 
 		String msgNoStr = msgNumberPart.getText();
 		messageNumber = Long.parseLong(msgNoStr);
@@ -70,7 +74,7 @@
 		messageNoElement.setText(Long.toString(messageNumber));
 		element.addChild(messageNoElement);
 		
-		messageNoElement = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMElement(Constants.WSRM.MSG_NUMBER,msgNoNamespace);
+		messageNoElement = factory.createOMElement(Constants.WSRM.MSG_NUMBER,rmNamespace);
 		
 		return element;
 	}

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Nack.java Sun Nov  6 10:57:13 2005
@@ -19,6 +19,7 @@
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
 
@@ -32,11 +33,15 @@
 	private OMElement nackElement;
 	private long nackNumber;
 	
-	OMNamespace rmNamespace =
-		SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+	SOAPFactory factory;
 	
-	public Nack(){
-		nackElement = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNamespace = null;
+	
+		
+	public Nack(SOAPFactory factory){
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		nackElement = factory.createOMElement(
 				Constants.WSRM.NACK,rmNamespace);
 	}
 	
@@ -58,7 +63,7 @@
 			throw new OMException ("Nack element does not contain a valid long value");
 		}
 		
-		nackElement = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMElement(
+		nackElement = factory.createOMElement(
 				Constants.WSRM.NACK,rmNamespace);
 		
 		return this;
@@ -77,7 +82,7 @@
 		nackElement.setText(Long.toString(nackNumber));
 		sequenceAckElement.addChild(nackElement);
 
-		nackElement = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.DEFAULT).createOMElement(
+		nackElement = factory.createOMElement(
 				Constants.WSRM.NACK,rmNamespace);
 		
 		return sequenceAckElement;

Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java?rev=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/RMElements.java Sun Nov  6 10:57:13 2005
@@ -17,11 +17,18 @@
 package org.apache.sandesha2.wsrm;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
+import org.apache.axis2.soap.SOAP11Constants;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.sandesha2.Constants;
+import org.apache.sandesha2.util.SOAPAbstractFactory;
 
 /**
  * @author Saminda
@@ -42,16 +49,26 @@
 	private TerminateSequence terminateSequence = null;
 
 	private AckRequested ackRequested = null;
-
+	
+	private SOAPFactory factory;
+	
 	public void fromSOAPEnvelope(SOAPEnvelope envelope) {
 
 		if (envelope == null)
 			throw new OMException("The passed envelope is null");
 
+		SOAPFactory factory;
+		
+		//Ya I know. Could hv done it directly :D (just to make it consistent)
+		if (envelope.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
+			factory = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.v1_1);
+		else
+			factory = SOAPAbstractFactory.getSOAPFactory(Constants.SOAPVersion.v1_2);
+			
 		OMElement sequenceElement = envelope.getHeader().getFirstChildWithName(
 				new QName(Constants.WSRM.NS_URI_RM, Constants.WSRM.SEQUENCE));
 		if (sequenceElement != null) {
-			sequence = new Sequence();
+			sequence = new Sequence(factory);
 			sequence.fromOMElement(envelope.getHeader());
 		}
 
@@ -60,15 +77,16 @@
 						new QName(Constants.WSRM.NS_URI_RM,
 								Constants.WSRM.SEQUENCE_ACK));
 		if (sequenceAckElement != null) {
-			sequenceAcknowledgement = new SequenceAcknowledgement();
+			sequenceAcknowledgement = new SequenceAcknowledgement(factory);
 			sequenceAcknowledgement.fromOMElement(envelope.getHeader());
 		}
 
 		OMElement createSeqElement = envelope.getBody().getFirstChildWithName(
 				new QName(Constants.WSRM.NS_URI_RM,
 						Constants.WSRM.CREATE_SEQUENCE));
+		
 		if (createSeqElement != null) {
-			createSequence = new CreateSequence();
+			createSequence = new CreateSequence(factory);
 			createSequence.fromOMElement(envelope.getBody());
 		}
 
@@ -77,7 +95,7 @@
 						new QName(Constants.WSRM.NS_URI_RM,
 								Constants.WSRM.CREATE_SEQUENCE_RESPONSE));
 		if (createSeqResElement != null) {
-			createSequenceResponse = new CreateSequenceResponse();
+			createSequenceResponse = new CreateSequenceResponse(factory);
 			createSequenceResponse.fromOMElement(envelope.getBody());
 		}
 
@@ -86,7 +104,7 @@
 						new QName(Constants.WSRM.NS_URI_RM,
 								Constants.WSRM.TERMINATE_SEQUENCE));
 		if (terminateSeqElement != null) {
-			terminateSequence = new TerminateSequence();
+			terminateSequence = new TerminateSequence(factory);
 			terminateSequence.fromOMElement(envelope.getBody());
 		}
 
@@ -95,7 +113,7 @@
 						new QName(Constants.WSRM.NS_URI_RM,
 								Constants.WSRM.ACK_REQUESTED));
 		if (ackRequestedElement != null) {
-			ackRequested = new AckRequested();
+			ackRequested = new AckRequested(factory);
 			ackRequested.fromOMElement(envelope.getHeader());
 		}
 	}

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/Sequence.java Sun Nov  6 10:57:13 2005
@@ -22,6 +22,7 @@
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.SOAPHeader;
 import org.apache.axis2.soap.SOAPHeaderBlock;
 import org.apache.sandesha2.Constants;
@@ -43,13 +44,15 @@
 
 	private LastMessage lastMessage = null;
 
-	OMNamespace seqNoNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public Sequence() {
-		sequenceElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	private SOAPFactory factory;
+	
+	OMNamespace seqNoNamespace = null;
+
+	public Sequence(SOAPFactory factory) {
+		this.factory = factory;
+		seqNoNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		sequenceElement = factory.createOMElement(
 				Constants.WSRM.SEQUENCE, seqNoNamespace);
 	}
 
@@ -71,12 +74,11 @@
 			throw new OMException(
 					"Cannot find Sequence element in the given element");
 
-		sequenceElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		sequenceElement = factory.createOMElement(
 				Constants.WSRM.SEQUENCE, seqNoNamespace);
 
-		identifier = new Identifier();
-		messageNumber = new MessageNumber();
+		identifier = new Identifier(factory);
+		messageNumber = new MessageNumber(factory);
 		identifier.fromOMElement(sequencePart);
 		messageNumber.fromOMElement(sequencePart);
 
@@ -85,7 +87,7 @@
 						Constants.WSRM.LAST_MSG));
 
 		if (lastMessageElement != null) {
-			lastMessage = new LastMessage();
+			lastMessage = new LastMessage(factory);
 			lastMessage.fromOMElement(sequencePart);
 		}
 
@@ -124,8 +126,7 @@
 
 		//resetting the element. So that subsequest toOMElement calls will
 		// attach a different object.
-		this.sequenceElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		this.sequenceElement = factory.createOMElement(
 				Constants.WSRM.SEQUENCE, seqNoNamespace);
 
 		return headerElement;

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=331136&r1=331135&r2=331136&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/wsrm/SequenceAcknowledgement.java Sun Nov  6 10:57:13 2005
@@ -26,6 +26,7 @@
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.om.OMNamespace;
 import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFactory;
 import org.apache.axis2.soap.SOAPHeader;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.util.SOAPAbstractFactory;
@@ -37,6 +38,7 @@
  */
 
 public class SequenceAcknowledgement implements IOMRMPart {
+	
 	private OMElement sequenceAcknowledgementElement;
 
 	private Identifier identifier;
@@ -45,13 +47,15 @@
 
 	private ArrayList nackList;
 
-	OMNamespace rmNamespace = SOAPAbstractFactory.getSOAPFactory(
-			Constants.SOAPVersion.DEFAULT).createOMNamespace(
-			Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
-
-	public SequenceAcknowledgement() {
-		sequenceAcknowledgementElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+	OMNamespace rmNamespace = null;
+
+	SOAPFactory factory;
+	
+	public SequenceAcknowledgement(SOAPFactory factory) {
+		this.factory = factory;
+		rmNamespace = factory.createOMNamespace(
+				Constants.WSRM.NS_URI_RM, Constants.WSRM.NS_PREFIX_RM);
+		sequenceAcknowledgementElement = factory.createOMElement(
 				Constants.WSRM.SEQUENCE_ACK, rmNamespace);
 		acknowledgementRangeList = new ArrayList();
 		nackList = new ArrayList();
@@ -75,7 +79,7 @@
 			throw new OMException(
 					"The passed element does not contain a seqence ackknowledgement Part");
 
-		identifier = new Identifier();
+		identifier = new Identifier(factory);
 		identifier.fromOMElement(sequenceAckPart);
 
 		Iterator ackRangeParts = sequenceAckPart.getChildrenWithName(new QName(
@@ -84,7 +88,7 @@
 		while (ackRangeParts.hasNext()) {
 			OMElement ackRangePart = (OMElement) ackRangeParts.next();
 
-			AcknowledgementRange ackRange = new AcknowledgementRange();
+			AcknowledgementRange ackRange = new AcknowledgementRange(factory);
 			ackRange.fromOMElement(ackRangePart);
 			acknowledgementRangeList.add(ackRange);
 		}
@@ -94,13 +98,12 @@
 
 		while (nackParts.hasNext()) {
 			OMElement nackPart = (OMElement) nackParts.next();
-			Nack nack = new Nack();
+			Nack nack = new Nack(factory);
 			nack.fromOMElement(nackPart);
 			nackList.add(nack);
 		}
 
-		sequenceAcknowledgementElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		sequenceAcknowledgementElement = factory.createOMElement(
 				Constants.WSRM.SEQUENCE_ACK, rmNamespace);
 
 		return this;
@@ -138,8 +141,7 @@
 
 		SOAPHeader.addChild(sequenceAcknowledgementElement);
 
-		sequenceAcknowledgementElement = SOAPAbstractFactory.getSOAPFactory(
-				Constants.SOAPVersion.DEFAULT).createOMElement(
+		sequenceAcknowledgementElement = factory.createOMElement(
 				Constants.WSRM.SEQUENCE_ACK, rmNamespace);
 
 		return header;



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