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/10/13 06:46:11 UTC

svn commit: r320653 - in /webservices/sandesha/trunk/src/org/apache/sandesha2: ./ client/ handlers/ msgprocessors/

Author: chamikara
Date: Wed Oct 12 21:45:17 2005
New Revision: 320653

URL: http://svn.apache.org/viewcvs?rev=320653&view=rev
Log:
Client side - Basic message exchange is working for the echo case of a single application message.

Added:
    webservices/sandesha/trunk/src/org/apache/sandesha2/client/
    webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/client/TwoWayOptionalTransportBasedSender.java
Modified:
    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/SandeshaInHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.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/msgprocessors/TerminateSeqMsgProcessor.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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Wed Oct 12 21:45:17 2005
@@ -235,7 +235,7 @@
 
 	int SENDER_SLEEP_TIME = 1000;
 	
-	int CLIENT_SLEEP_TIME = 1000;
+	int CLIENT_SLEEP_TIME = 10000;
 
 	int TERMINATE_DELAY = 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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java Wed Oct 12 21:45:17 2005
@@ -16,6 +16,7 @@
  */
 package org.apache.sandesha2;
 
+import java.lang.reflect.InvocationTargetException;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -25,7 +26,9 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.clientapi.Call;
 import org.apache.axis2.clientapi.InOutMEPClient;
+import org.apache.axis2.clientapi.MessageSender;
 import org.apache.axis2.clientapi.TwoWayTransportBasedSender;
 import org.apache.axis2.context.AbstractContext;
 import org.apache.axis2.context.ConfigurationContext;
@@ -33,6 +36,8 @@
 import org.apache.axis2.context.OperationContext;
 import org.apache.axis2.description.OperationDescription;
 import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.sandesha2.client.SandeshaMepClient;
 import org.apache.sandesha2.msgreceivers.RMMessageReceiver;
 import org.apache.sandesha2.storage.AbstractBeanMgrFactory;
 import org.apache.sandesha2.storage.beanmanagers.RetransmitterBeanMgr;
@@ -85,9 +90,48 @@
 					if (msgCtx.isServerSide())
 						new AxisEngine(context).send(msgCtx);
 					else {
-						//TwoWayTransportBasedSender sender = new TwoWayTransportBasedSender ();
-						TwoWayTransportBasedSender.send(msgCtx, msgCtx.getTransportIn());
-						//inOutMepClient.invokeBlocking(msgCtx.getOperationDescription(),msgCtx);
+						
+//						//TwoWayTransportBasedSender.send(msgCtx, msgCtx.getTransportIn());
+//						
+//						//boolean invokeBlocking = isInvocationTypeBlocking (rmMsgCtx);
+//						
+//						//if (msgCtx.getOperationDescription().getMessageExchangePattern()==req-res)
+//						//{
+//						InOutMEPClient inoutClient = new InOutMEPClient (msgCtx.getServiceContext());
+//						Call call = new Call ();
+//						call.in
+//						inoutClient.setTransportInfo(msgCtx.get);
+//						if (invokeBlocking){
+//							inoutClient.invokeBlocking(msgCtx.getOperationDescription(),msgCtx);
+//						}else {
+//							inoutClient.invokeNonBlocking(msgCtx.getOperationDescription(),msgCtx,new SandeshaCallback ());
+//						}
+//						//}
+						
+						
+						boolean responseExpected = isResponseExpected (rmMsgCtx);
+						
+						if (responseExpected){
+							//Call inOutMepClient = new Call (msgCtx.getServiceContext());
+							//inOutMepClient.setTo(msgCtx.getTo());
+							
+							//this will start the listner.
+				
+							SandeshaMepClient inOutMepClient = new SandeshaMepClient (msgCtx.getServiceContext());
+							//inOutMepClient.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,true);
+							inOutMepClient.setTo(msgCtx.getTo());
+							inOutMepClient.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,true);
+							inOutMepClient.invokeDual(msgCtx.getOperationDescription(),msgCtx);
+							//inOutMepClient.setTransportInfo(org.apache.axis2.Constants.TRANSPORT_HTTP,org.apache.axis2.Constants.TRANSPORT_HTTP,false);
+							//call.invokeBlocking(msgCtx.getOperationDescription(),msgCtx);
+						}else {
+							MessageSender sender = new MessageSender ();
+							sender.setTo(msgCtx.getTo());
+							sender.send(msgCtx.getOperationDescription(),msgCtx);
+						}
+
+						
+						
 					}
 
 				} catch (AxisFault e1) {
@@ -119,6 +163,22 @@
 
 	}
 
+	private boolean isResponseExpected (RMMsgContext rmMsgCtx) {
+		boolean responseExpected = false;
+		
+		if (rmMsgCtx.getMessageType()==Constants.MessageTypes.CREATE_SEQ){
+			responseExpected = true;
+		}if (rmMsgCtx.getMessageType()==Constants.MessageTypes.APPLICATION) {
+			//a ack may arrive. (not a application response)
+			if (rmMsgCtx.getMessageContext().getOperationDescription().getMessageExchangePattern().equals(
+					org.apache.wsdl.WSDLConstants.MEP_URI_IN_OUT)) {
+					responseExpected = true;
+			}
+		}
+		
+		return true;
+	}
+	
 	public void start(ConfigurationContext context) {
 		senderStarted = true;
 		this.context = context;
@@ -129,9 +189,14 @@
 		try {
 			RMMsgContext rmMsgCtx1 = MsgInitializer.initializeMessage(msgCtx1);
 			rmMsgCtx1.addSOAPEnvelope();
+			
+		
+			
 		} catch (AxisFault e) {
 			throw new SandeshaException("Exception in updating contexts");
 		}
+		
+		
 	}
 
 }

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java?rev=320653&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaCallback.java Wed Oct 12 21:45:17 2005
@@ -0,0 +1,23 @@
+/*
+ * Created on Oct 11, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.sandesha2.client;
+
+import org.apache.axis2.clientapi.AsyncResult;
+import org.apache.axis2.clientapi.Callback;
+
+
+public class SandeshaCallback extends Callback {
+
+	
+	public void onComplete(AsyncResult result) {
+		System.out.println("OnComplete of SandeshaCallback was called");
+	}
+	public void reportError(Exception e) {
+		System.out.println("reportError of SandeshaCallback was called");
+	}
+	
+}

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java?rev=320653&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/SandeshaMepClient.java Wed Oct 12 21:45:17 2005
@@ -0,0 +1,210 @@
+/*
+ * 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.client;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.clientapi.CallbackReceiver;
+import org.apache.axis2.clientapi.ListenerManager;
+import org.apache.axis2.clientapi.MEPClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.OperationDescription;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.description.TransportOutDescription;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.soap.SOAPFault;
+import org.apache.axis2.transport.TransportListener;
+import org.apache.wsdl.WSDLConstants;
+
+import javax.xml.namespace.QName;
+
+public class SandeshaMepClient extends MEPClient {
+
+	//protected long timeOutInMilliSeconds = 2000;
+
+	protected TransportListener listener;
+
+	protected TransportOutDescription senderTransport;
+
+	protected TransportInDescription listenerTransport;
+
+	protected boolean hasAsyncResponse = false;
+
+	protected EndpointReference to;
+
+	protected CallbackReceiver callbackReceiver;
+
+	public SandeshaMepClient(ServiceContext serviceContext) {
+		super(serviceContext, WSDLConstants.MEP_URI_OUT_IN);
+		//service context has the engine context set in to it !
+		callbackReceiver = new CallbackReceiver();
+	}
+
+	public MessageContext invokeDual(OperationDescription axisop,
+			final MessageContext msgctx) throws AxisFault {
+
+		prepareInvocation(axisop, msgctx);
+
+		String messageID = msgctx.getMessageID();
+		if (messageID == null) {
+			messageID = String.valueOf(System.currentTimeMillis());
+			msgctx.setMessageID(messageID);
+		}
+
+		SandeshaCallback callback = new SandeshaCallback();
+
+		if (hasAsyncResponse) {
+			checkTransport(msgctx);
+			axisop.setMessageReceiver(callbackReceiver);
+			callbackReceiver.addCallback(messageID, callback);
+			msgctx.setReplyTo(ListenerManager.replyToEPR(serviceContext
+					.getServiceConfig().getName().getLocalPart()
+					+ "/" + axisop.getName().getLocalPart(), listenerTransport
+					.getName().getLocalPart()));
+		}
+		
+		msgctx.setTo(to);
+		msgctx.setServiceContext(serviceContext);
+		ConfigurationContext syscontext = serviceContext.getEngineContext();
+		msgctx.setConfigurationContext(syscontext);
+
+		checkTransport(msgctx);
+
+		OperationContext operationContext = new OperationContext(axisop,
+				serviceContext);
+		axisop.registerOperationContext(msgctx, operationContext);
+
+		//Send the SOAP Message and receive a response if present.
+		MessageContext response = TwoWayOptionalTransportBasedSender.send(
+				msgctx, listenerTransport);
+
+		//give a sync response only if present.
+		if (response != null) {
+			//check for a fault and return the result
+			SOAPEnvelope resenvelope = response.getEnvelope();
+			if (resenvelope.getBody().hasFault()) {
+				SOAPFault soapFault = resenvelope.getBody().getFault();
+				Exception ex = soapFault.getException();
+
+				if (isExceptionToBeThrownOnSOAPFault) {
+					//does the SOAPFault has a detail element for Excpetion
+					if (ex != null) {
+						throw new AxisFault(ex);
+					} else {
+						//if detail element not present create a new Exception
+						// from the detail
+						String message = "";
+						message = message + "Code =" + soapFault.getCode() == null ? ""
+								: soapFault.getCode().getValue() == null ? ""
+										: soapFault.getCode().getValue()
+												.getText();
+						message = message + "Reason =" + soapFault.getReason() == null ? ""
+								: soapFault.getReason().getSOAPText() == null ? ""
+										: soapFault.getReason().getSOAPText()
+												.getText();
+						throw new AxisFault(message);
+					}
+				}
+			}
+		}
+		return response;
+
+	}
+
+	public void setTo(EndpointReference to) {
+		this.to = to;
+	}
+
+	public void setTransportInfo(String senderTransport,
+			String listenerTransport, boolean hasAsyncResponse)
+			throws AxisFault {
+		//here we check for a legal combination, for and example if the
+		// sendertransport is http and listner
+		//transport is smtp the invocation must using seperate transport
+		if (!hasAsyncResponse) {
+			boolean isTransportsEqual = senderTransport
+					.equals(listenerTransport);
+			boolean isATwoWaytransport = Constants.TRANSPORT_HTTP
+					.equals(senderTransport)
+					|| Constants.TRANSPORT_TCP.equals(senderTransport);
+			if ((!isTransportsEqual || !isATwoWaytransport)) {
+				throw new AxisFault(Messages
+						.getMessage("useSeparateListenerLimited"));
+			}
+		} else {
+			this.hasAsyncResponse = hasAsyncResponse;
+
+		}
+
+		//find and set the transport details
+		AxisConfiguration axisConfig = serviceContext.getEngineContext()
+				.getAxisConfiguration();
+		this.listenerTransport = axisConfig.getTransportIn(new QName(
+				listenerTransport));
+		this.senderTransport = axisConfig.getTransportOut(new QName(
+				senderTransport));
+		if (this.senderTransport == null) {
+			throw new AxisFault(Messages.getMessage("unknownTransport",
+					senderTransport));
+		}
+		if (this.listenerTransport == null) {
+			throw new AxisFault(Messages.getMessage("unknownTransport",
+					listenerTransport));
+		}
+
+		//if seperate transport is used, start the required listeners
+		if (hasAsyncResponse) {
+			if (!serviceContext.getEngineContext().getAxisConfiguration()
+					.isEngaged(new QName(Constants.MODULE_ADDRESSING))) {
+				throw new AxisFault(Messages
+						.getMessage("2channelNeedAddressing"));
+			}
+			ListenerManager.makeSureStarted(listenerTransport, serviceContext
+					.getEngineContext());
+		}
+	}
+
+	private void checkTransport(MessageContext msgctx) throws AxisFault {
+		if (senderTransport == null) {
+			senderTransport = inferTransport(to);
+		}
+		if (listenerTransport == null) {
+			listenerTransport = serviceContext.getEngineContext()
+					.getAxisConfiguration().getTransportIn(
+							senderTransport.getName());
+		}
+
+		if (msgctx.getTransportIn() == null) {
+			msgctx.setTransportIn(listenerTransport);
+		}
+		if (msgctx.getTransportOut() == null) {
+			msgctx.setTransportOut(senderTransport);
+		}
+
+	}
+
+	public void close() throws AxisFault {
+		ListenerManager.stop(listenerTransport.getName().getLocalPart());
+	}
+
+}
\ No newline at end of file

Added: webservices/sandesha/trunk/src/org/apache/sandesha2/client/TwoWayOptionalTransportBasedSender.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/client/TwoWayOptionalTransportBasedSender.java?rev=320653&view=auto
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/client/TwoWayOptionalTransportBasedSender.java (added)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/client/TwoWayOptionalTransportBasedSender.java Wed Oct 12 21:45:17 2005
@@ -0,0 +1,75 @@
+/*
+ * 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.client;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.soap.SOAPEnvelope;
+import org.apache.axis2.transport.TransportUtils;
+
+public class TwoWayOptionalTransportBasedSender {
+	public static MessageContext send(MessageContext msgctx,
+			TransportInDescription transportIn) throws AxisFault {
+
+		AxisEngine engine = new AxisEngine(msgctx.getSystemContext());
+		engine.send(msgctx);
+
+		boolean responsePresent = (msgctx
+				.getProperty(MessageContext.TRANSPORT_IN) != null);
+		//create the response
+		MessageContext response = null;
+		
+		//response is given only if required.
+		if (responsePresent) {
+			response = new MessageContext(msgctx
+					.getSystemContext(), msgctx.getSessionContext(), msgctx
+					.getTransportIn(), msgctx.getTransportOut());
+			response.setProperty(MessageContext.TRANSPORT_IN, msgctx
+					.getProperty(MessageContext.TRANSPORT_IN));
+			
+			OperationContext newOperationContext = new OperationContext (msgctx.getOperationDescription());
+			
+			msgctx.getOperationDescription().registerOperationContext(response,
+					newOperationContext);
+			response.setServerSide(false);
+			response.setServiceContext(msgctx.getServiceContext());
+			response.setServiceGroupContext(msgctx.getServiceGroupContext());
+
+			//If request is REST we assume the response is REST, so set the
+			// variable
+			response.setDoingREST(msgctx.isDoingREST());
+
+			SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(
+					response, msgctx.getEnvelope().getNamespace().getName());
+
+			if (resenvelope != null) {
+				response.setEnvelope(resenvelope);
+				engine = new AxisEngine(msgctx.getSystemContext());
+				engine.receive(response);
+			} else {
+				throw new AxisFault(Messages
+						.getMessage("blockInvocationExpectsRes="));
+			}
+		}
+		return response;
+	}
+
+}
\ No newline at end of file

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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java Wed Oct 12 21:45:17 2005
@@ -20,11 +20,16 @@
 import java.util.ArrayList;
 
 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.AxisFault;
 import org.apache.axis2.addressing.MessageInformationHeaders;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.MsgInitializer;
 import org.apache.sandesha2.MsgValidator;
@@ -54,6 +59,21 @@
 		} catch (SandeshaException ex) {
 			throw new AxisFault("Cant initialize the message");
 		}
+
+//		try {
+//			System.out.println("SandeshaInHandler Got a message of type:" + rmMsgCtx.getMessageType());
+//			XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
+//			SOAPEnvelope env123 = msgCtx.getEnvelope();
+//			env123.serialize(writer);
+//		} catch (XMLStreamException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		} catch (FactoryConfigurationError e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+			
+
 
 		MsgProcessor msgProcessor = MsgProcessorFactory
 				.getMessageProcessor(rmMsgCtx.getMessageType());

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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java Wed Oct 12 21:45:17 2005
@@ -266,6 +266,9 @@
 
 				} else {
 
+					//setting reply to FIXME
+					//msgCtx.setReplyTo(new EndpointReference ("http://localhost:9070/somethingWorking"));
+					
 					//Setting WSA Action if null
 					//TODO: Recheck weather this action is correct
 					if (msgCtx.getWSAAction() == null) {
@@ -317,7 +320,8 @@
 											Constants.SequenceProperties.OUT_SEQUENCE_ID);
 							if (outSequenceBean == null) {
 								try {
-									Thread.sleep(Constants.CLIENT_SLEEP_TIME);
+									//Thread.sleep(Constants.CLIENT_SLEEP_TIME);
+									wait();
 								} catch (InterruptedException e1) {
 									System.out
 											.println("Client was interupted...");
@@ -345,6 +349,11 @@
 		RMMsgContext createSeqRMMessage = RMMsgCreator.createCreateSeqMsg(
 				applicationRMMsg, tempSequenceId);
 		MessageContext createSeqMsg = createSeqRMMessage.getMessageContext();
+		
+		
+		//TODO remove below
+		//createSeqMsg.setReplyTo(new EndpointReference ("http://localhost:9070/somethingWorking"));
+		
 		createSeqMsg.setRelatesTo(null); //create seq msg does not relateTo
 		// anything
 		AbstractContext context = applicationRMMsg.getContext();
@@ -472,9 +481,15 @@
 		} else {
 			//client side
 			Object obj = msg.getProperty(Constants.LAST_MESSAGE);
-			if (obj != null && "true".equals(obj)) {
+			//if (obj != null && "true".equals(obj)) {
 				sequence.setLastMessage(new LastMessage());
-			}
+				//saving the last message no.
+				SequencePropertyBean lastOutMsgBean = new SequencePropertyBean(
+						tempSequenceId,
+						Constants.SequenceProperties.LAST_OUT_MESSAGE,
+						new Long(messageNumber));
+				sequencePropertyMgr.insert(lastOutMsgBean);
+			//}
 		}
 
 		//setting the Sequnece id.

Modified: 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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/AcknowledgementProcessor.java Wed Oct 12 21:45:17 2005
@@ -162,21 +162,22 @@
 		//detting addressing headers.
 		SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory.getInstance(
 				incomingAckRMMsg.getContext()).getSequencePropretyBeanMgr();
-		SequencePropertyBean replyToBean = seqPropMgr.retrieve(tempSequenceId,Constants.SequenceProperties.REPLY_TO_EPR);
+		//SequencePropertyBean replyToBean = seqPropMgr.retrieve(tempSequenceId,Constants.SequenceProperties.REPLY_TO_EPR);
 		SequencePropertyBean toBean = seqPropMgr.retrieve(tempSequenceId,Constants.SequenceProperties.TO_EPR);
-		if (replyToBean==null)
-			throw new SandeshaException ("ReplyTo property is not set");
+//		if (replyToBean==null)
+//			throw new SandeshaException ("ReplyTo property is not set");
 		
-		EndpointReference replyToEPR = (EndpointReference) replyToBean.getValue();
-		if (replyToEPR==null)
-			throw new SandeshaException ("ReplyTo EPR has an invalid value");
+//		EndpointReference replyToEPR = (EndpointReference) replyToBean.getValue();
+//		if (replyToEPR==null)
+//			throw new SandeshaException ("ReplyTo EPR has an invalid value");
 		 
 		EndpointReference toEPR = (EndpointReference) toBean.getValue();
-		if (replyToEPR==null)
+		if (toEPR==null)
 			throw new SandeshaException ("To EPR has an invalid value");
 		
 		terminateRMMessage.setTo(new EndpointReference (toEPR.getAddress()));
-		terminateRMMessage.setFrom(new EndpointReference (replyToEPR.getAddress()));
+		
+		//terminateRMMessage.setFrom(new EndpointReference (replyToEPR.getAddress()));
 		terminateRMMessage
 				.setWSAAction(Constants.WSRM.Actions.TERMINATE_SEQUENCE);
 

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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Wed Oct 12 21:45:17 2005
@@ -52,6 +52,7 @@
 import org.apache.sandesha2.util.SandeshaUtil;
 import org.apache.sandesha2.wsrm.AcknowledgementRange;
 import org.apache.sandesha2.wsrm.Sequence;
+import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 import org.apache.wsdl.WSDLConstants;
 import org.ietf.jgss.MessageProp;
 
@@ -64,6 +65,14 @@
 
 	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
 
+		//Processing for ack if any
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		if (sequenceAck!=null) {
+			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
+			ackProcessor.processMessage(rmMsgCtx);
+		}
+		
+		//Processing the application message.
 		MessageContext msgCtx = rmMsgCtx.getMessageContext();
 		if (msgCtx == null)
 			throw new SandeshaException("Message context is null");
@@ -127,7 +136,7 @@
 			throw new SandeshaException(
 					"Seqeunce properties are not set correctly");
 
-		if (acksToStr.equals(Constants.WSA.NS_URI_ANONYMOUS)) {
+		//if (acksToStr.equals(Constants.WSA.NS_URI_ANONYMOUS)) {
 
 			RMMsgContext ackRMMsgCtx = SandeshaUtil.deepCopy(rmMsgCtx);
 			MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();
@@ -176,9 +185,9 @@
 				throw new SandeshaException(e1.getMessage());
 			}
 
-		} else {
-			//TODO Add async Ack
-		}
+//		} else {
+//			//TODO Add async Ack
+//		}
 
 		//		Pause the messages bean if not the right message to invoke.
 		NextMsgBeanMgr mgr = AbstractBeanMgrFactory.getInstance(configCtx)

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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqMsgProcessor.java Wed Oct 12 21:45:17 2005
@@ -21,6 +21,7 @@
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
 import org.apache.sandesha2.wsrm.CreateSequence;
+import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 
 /**
  * @author 
@@ -29,6 +30,15 @@
 public class CreateSeqMsgProcessor implements MsgProcessor {
 
 	public void processMessage(RMMsgContext rmMsgCtx) throws SandeshaException {
+		
+		//Processing for ack if any
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		if (sequenceAck!=null) {
+			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
+			ackProcessor.processMessage(rmMsgCtx);
+		}
+		
+		//Processing the create sequence 
 		//TODO: Add create sequence message processing logic
 		CreateSequence createSeq = (CreateSequence) rmMsgCtx.getMessagePart(Constants.MessageParts.CREATE_SEQ);
 

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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/CreateSeqResponseMsgProcessor.java Wed Oct 12 21:45:17 2005
@@ -33,6 +33,7 @@
 import org.apache.sandesha2.wsrm.Identifier;
 import org.apache.sandesha2.wsrm.MessageNumber;
 import org.apache.sandesha2.wsrm.Sequence;
+import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -50,6 +51,14 @@
 	public void processMessage(RMMsgContext createSeqResponseRMMsgCtx)
 			throws SandeshaException {
 
+		//Processing for ack if any
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) createSeqResponseRMMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		if (sequenceAck!=null) {
+			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
+			ackProcessor.processMessage(createSeqResponseRMMsgCtx);
+		}
+		
+		//Processing the create sequence response.
 		CreateSequenceResponse createSeqResponsePart = (CreateSequenceResponse) createSeqResponseRMMsgCtx
 				.getMessagePart(Constants.MessageParts.CREATE_SEQ_RESPONSE);
 		if (createSeqResponsePart == 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=320653&r1=320652&r2=320653&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/TerminateSeqMsgProcessor.java Wed Oct 12 21:45:17 2005
@@ -17,8 +17,10 @@
 
 package org.apache.sandesha2.msgprocessors;
 
+import org.apache.sandesha2.Constants;
 import org.apache.sandesha2.RMMsgContext;
 import org.apache.sandesha2.SandeshaException;
+import org.apache.sandesha2.wsrm.SequenceAcknowledgement;
 
 /**
  * @author
@@ -28,6 +30,14 @@
 
 	public void processMessage(RMMsgContext rmMsgCtx)
 			throws SandeshaException {
+		//Processing for ack if any
+		SequenceAcknowledgement sequenceAck = (SequenceAcknowledgement) rmMsgCtx.getMessagePart(Constants.MessageParts.SEQ_ACKNOWLEDGEMENT);
+		if (sequenceAck!=null) {
+			AcknowledgementProcessor ackProcessor = new AcknowledgementProcessor ();
+			ackProcessor.processMessage(rmMsgCtx);
+		}
+		
+		//Processing the terminate message
 		//TODO Add terminate sequence message logic.
 
 	}



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