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/09/29 18:08:51 UTC
svn commit: r292458 - in
/webservices/sandesha/trunk/src/org/apache/sandesha2: Constants.java
RMMsgContext.java RMMsgCreator.java Sender.java
handlers/ServerOutHandler.java msgprocessors/ApplicationMsgProcessor.java
util/SandeshaUtil.java
Author: chamikara
Date: Thu Sep 29 09:07:16 2005
New Revision: 292458
URL: http://svn.apache.org/viewcvs?rev=292458&view=rev
Log:
Some corrections made the following message exchange work for the echo case. (with Sandesha1 client)
--> create seq
<-- create seq res
--> app. msg. 1
<-- ack
--> terminate seq.
<-- create seq
--> create seq response
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/RMMsgCreator.java
webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java
webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.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=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Constants.java Thu Sep 29 09:07:16 2005
@@ -34,7 +34,7 @@
String ACTION_SEQ_ACK = "http://schemas.xmlsoap.org/ws/2005/02/rm/SequenceAcknowledgement";
- String ACTION_CREATE_SEQ = "http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse";
+ String ACTION_CREATE_SEQ = "http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence";
String NS_URI_CREATE_SEQ_RESPONSE = "http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequenceResponse";
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=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgContext.java Thu Sep 29 09:07:16 2005
@@ -174,6 +174,14 @@
public void setRelatesTo(RelatesTo relatesTo) {
msgContext.setRelatesTo(relatesTo);
}
+
+ public void setWSAAction(String URI) {
+ msgContext.setWSAAction(URI);
+ }
+
+ public String getWSAAction () {
+ return msgContext.getWSAAction();
+ }
public MessageContext getMessageContext() {
return msgContext;
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java?rev=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/RMMsgCreator.java Thu Sep 29 09:07:16 2005
@@ -215,36 +215,11 @@
}
envelope = applicationMsg.getSOAPEnvelope();
-// MessageContext requestMessage = null;
-//
-// try {
-// requestMessage = applicationMsg.getMessageContext()
-// .getOperationContext().getMessageContext(
-// WSDLConstants.MESSAGE_LABEL_IN);
-// } catch (AxisFault e) {
-// throw new SandeshaException(e.getMessage());
-// }
-//
-// if (requestMessage == null)
-// throw new SandeshaException("Request message is null");
-//
-// RMMsgContext reqRMMsgCtx = null;
-//
-// reqRMMsgCtx = MsgInitializer.initializeMessage(requestMessage);
-
SequenceAcknowledgement sequenceAck = new SequenceAcknowledgement();
Identifier id = new Identifier();
id.setIndentifer(sequenceId);
sequenceAck.setIdentifier(id);
- // SequencePropertyBean seqPropBean = new SequencePropertyBean
- // (newSequenceId,Constants.SEQ_PROPERTY_RECEIVED_MESSAGES,acksTo);
- // SequencePropertyBeanMgr beanMgr = new SequencePropertyBeanMgr
- // (Constants.DEFAULT_STORAGE_TYPE);
- // SequencePropertyBean msgNosBean = (SequencePropertyBean)
- // beanMgr.retrieve(sequenceId,Constants.SEQ_PROPERTY_RECEIVED_MESSAGES);
- // String msgNoList = (String) msgNosBean.getValue();
-
ConfigurationContext ctx = applicationMsg.getMessageContext()
.getSystemContext();
SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
@@ -290,15 +265,6 @@
OperationContext ackOpCtx = new OperationContext(applicationMsgCtx
.getOperationDescription());
- // //TODO set a suitable request msg (if required)
- // MessageContext requestAppMsg = applicationMsgCtx
- // .getOperationContext().getMessageContext(
- // WSDLConstants.MESSAGE_LABEL_IN);
-
- //added request applicatin message as the request message for the
- // newly created ack.
- //this helps to tread addAck and createAck cases equally.
- //ackOpCtx.addMessageContext(requestAppMsg);
ackMsgCtx.setOperationContext(ackOpCtx);
ackOpCtx.addMessageContext(ackMsgCtx);
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=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sender.java Thu Sep 29 09:07:16 2005
@@ -78,6 +78,9 @@
// TODO Auto-generated catch block
e2.printStackTrace();
}
+
+ String action = msgCtx.getWSAAction();
+ System.out.println ("Action:" + action);
try {
new AxisEngine(context).send(msgCtx);
Modified: webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java
URL: http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java?rev=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/ServerOutHandler.java Thu Sep 29 09:07:16 2005
@@ -69,12 +69,6 @@
ConfigurationContext ctx = msgCtx.getSystemContext();
SandeshaUtil.startSenderIfStopped(ctx);
-
-
-
-
-
-
//getting rm message
RMMsgContext rmMsgCtx;
try {
@@ -164,11 +158,11 @@
ackMsgContext.setServiceContext(msgCtx.getServiceContext());
ackMsgContext.setServiceContextID(msgCtx
.getServiceContextID());
-
+
//TODO set a suitable operation description
OperationContext ackOpContext = new OperationContext(
reqMsgCtx.getOperationDescription());
-
+
ackOpContext.addMessageContext(ackMsgContext);
ackMsgContext.setOperationContext(ackOpContext);
RMMsgContext newRMMsgCtx = SandeshaUtil.deepCopy(rmMsgCtx);
@@ -189,32 +183,17 @@
//processing the response
processResponseMessage(newRMMsgCtx, requestRMMsgCtx);
- //msgCtx.setTo(null);
msgCtx.setPausedTrue(getName());
-
}
}
} catch (SandeshaException e) {
throw new AxisFault(e.getMessage());
}
-
- // serializing
- try {
- SOAPEnvelope env11 = msgCtx.getEnvelope();
- XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(System.out);
- env11.serialize(writer);
- } catch (XMLStreamException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (FactoryConfigurationError e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
}
- private void processResponseMessage(RMMsgContext rmMsg, RMMsgContext reqRMMsg)
- throws SandeshaException {
+ private void processResponseMessage(RMMsgContext rmMsg,
+ RMMsgContext reqRMMsg) throws SandeshaException {
if (rmMsg == null || reqRMMsg == null)
throw new SandeshaException("Message or reques message is null");
@@ -267,33 +246,27 @@
rmMsg.getMessageContext().setPausedTrue(getName());
RetransmitterBean appMsgEntry = new RetransmitterBean();
-
+
RMMsgContext copiedRMMsgCtx = SandeshaUtil.deepCopy(rmMsg);
MessageContext copiedMsgCtx = copiedRMMsgCtx.getMessageContext();
MessageContext msg = rmMsg.getMessageContext();
- //msg.setResponseWritten(false);
- //msg.setOutPutWritten(true);
- //msg.getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,org.apache.axis2.Constants.VALUE_TRUE);
-
-
- Object val = msg.getOperationContext().getProperty (org.apache.axis2.Constants.RESPONSE_WRITTEN);
- copiedMsgCtx.setServiceGroupContext(msg
- .getServiceGroupContext());
+
+ Object val = msg.getOperationContext().getProperty(
+ org.apache.axis2.Constants.RESPONSE_WRITTEN);
+ copiedMsgCtx.setServiceGroupContext(msg.getServiceGroupContext());
copiedMsgCtx.setServiceGroupContextId(msg
.getServiceGroupContextId());
- copiedMsgCtx.setServiceContext(msg
- .getServiceContext());
- copiedMsgCtx.setServiceContextID(msg
- .getServiceContextID());
+ copiedMsgCtx.setServiceContext(msg.getServiceContext());
+ copiedMsgCtx.setServiceContextID(msg.getServiceContextID());
copiedMsgCtx.setOperationContext(msg.getOperationContext());
-
+
//TODO IF - may not work when op context is changed
try {
msg.getOperationContext().addMessageContext(copiedMsgCtx);
} catch (AxisFault e) {
e.printStackTrace();
}
-
+
String key = SandeshaUtil.storeMessageContext(rmMsg
.getMessageContext());
appMsgEntry.setKey(key);
@@ -305,10 +278,7 @@
retransmitterMgr.insert(appMsgEntry);
addCreateSequenceMessage(rmMsg);
-
-
-
} else {
//Sequence id is present
//set sequence part
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=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/msgprocessors/ApplicationMsgProcessor.java Thu Sep 29 09:07:16 2005
@@ -54,7 +54,7 @@
import org.ietf.jgss.MessageProp;
/**
- * @author
+ * @author
*/
public class ApplicationMsgProcessor implements MsgProcessor {
@@ -63,9 +63,9 @@
System.out.println("Application msg processor called");
MessageContext msgCtx = rmMsgCtx.getMessageContext();
- if (msgCtx==null)
- throw new SandeshaException ("Message context is null");
-
+ if (msgCtx == null)
+ throw new SandeshaException("Message context is null");
+
if (rmMsgCtx.getProperty(Constants.APPLICATION_PROCESSING_DONE) != null
&& rmMsgCtx.getProperty(Constants.APPLICATION_PROCESSING_DONE)
.equals("true")) {
@@ -78,9 +78,9 @@
String sequenceId = sequence.getIdentifier().getIdentifier();
ConfigurationContext configCtx = rmMsgCtx.getMessageContext()
.getSystemContext();
- if (configCtx==null)
- throw new SandeshaException ("Configuration Context is null");
-
+ if (configCtx == null)
+ throw new SandeshaException("Configuration Context is null");
+
SequencePropertyBeanMgr seqPropMgr = AbstractBeanMgrFactory
.getInstance(configCtx).getSequencePropretyBeanMgr();
SequencePropertyBean msgsBean = seqPropMgr.retrieve(sequenceId,
@@ -114,7 +114,8 @@
Constants.SEQ_PROPERTY_ACKS_TO_EPR);
String acksToStr = null;
try {
- EndpointReference acksTo = (EndpointReference) acksToBean.getValue();
+ EndpointReference acksTo = (EndpointReference) acksToBean
+ .getValue();
acksToStr = acksTo.getAddress();
} catch (Exception e) {
e.printStackTrace();
@@ -130,71 +131,45 @@
if (acksToStr.equals(Constants.WSA.NS_URI_ANONYMOUS)) {
-// //Adding sync ack
-// //set acknowledgement
-// //TODO stop adding acks to every message. Add acks only when
-// // needed.
-//
-//
-//// try {
-//// MessageContext responseMsgCtx = rmMsgCtx.getMessageContext().getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT);
-//// if (responseMsgCtx==null){
-//// responseMsgCtx = new MessageContext (configCtx,rmMsgCtx.getMessageContext().getTransportIn(),rmMsgCtx.getMessageContext().getTransportOut());
-//// rmMsgCtx.getMessageContext().getOperationContext().addMessageContext(responseMsgCtx);
-////
-//// //TODO following line is due to a bug in Axis2. Remove this when it is fixed.
-//// responseMsgCtx.setOperationContext(rmMsgCtx.getMessageContext().getOperationContext());
-//// }
-////
-//// RMMsgContext responseRMMsg = new RMMsgContext (responseMsgCtx);
-//// RMMsgCreator.addAckMessage(responseRMMsg);
-////
-//// } catch (AxisFault af) {
-//// throw new SandeshaException (af.getMessage());
-//// }
-
-
RMMsgContext ackRMMsgCtx = SandeshaUtil.deepCopy(rmMsgCtx);
MessageContext ackMsgCtx = ackRMMsgCtx.getMessageContext();
- ackMsgCtx.setServiceGroupContext(msgCtx
- .getServiceGroupContext());
+ ackMsgCtx.setServiceGroupContext(msgCtx.getServiceGroupContext());
ackMsgCtx.setServiceGroupContextId(msgCtx
.getServiceGroupContextId());
ackMsgCtx.setServiceContext(msgCtx.getServiceContext());
- ackMsgCtx.setServiceContextID(msgCtx
- .getServiceContextID());
-
+ ackMsgCtx.setServiceContextID(msgCtx.getServiceContextID());
+
//TODO set a suitable operation description
- OperationContext ackOpContext = new OperationContext(
- msgCtx.getOperationDescription());
-
+ OperationContext ackOpContext = new OperationContext(msgCtx
+ .getOperationDescription());
+
try {
ackOpContext.addMessageContext(ackMsgCtx);
} catch (AxisFault e2) {
- throw new SandeshaException (e2.getMessage());
+ throw new SandeshaException(e2.getMessage());
}
ackMsgCtx.setOperationContext(ackOpContext);
-
+
//Set new envelope
- SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(Constants.DEFAULT_SOAP_VERSION).getDefaultEnvelope();
+ SOAPEnvelope envelope = SOAPAbstractFactory.getSOAPFactory(
+ Constants.DEFAULT_SOAP_VERSION).getDefaultEnvelope();
try {
ackMsgCtx.setEnvelope(envelope);
} catch (AxisFault e3) {
- throw new SandeshaException (e3.getMessage());
+ throw new SandeshaException(e3.getMessage());
}
-
+
//FIXME set acksTo instead of ReplyTo
ackMsgCtx.setTo(msgCtx.getReplyTo());
ackMsgCtx.setReplyTo(msgCtx.getTo());
- RMMsgCreator.addAckMessage(ackRMMsgCtx,sequenceId);
+ RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId);
-
- AxisEngine engine = new AxisEngine(
- ackRMMsgCtx.getMessageContext().getSystemContext());
- try {
+ AxisEngine engine = new AxisEngine(ackRMMsgCtx.getMessageContext()
+ .getSystemContext());
+ try {
engine.send(ackRMMsgCtx.getMessageContext());
} catch (AxisFault e1) {
- throw new SandeshaException (e1.getMessage());
+ throw new SandeshaException(e1.getMessage());
}
} else {
@@ -258,8 +233,7 @@
"true");
System.out.println("paused");
-
-
+
} catch (Exception ex) {
throw new SandeshaException(ex.getMessage());
}
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=292458&r1=292457&r2=292458&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java (original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/util/SandeshaUtil.java Thu Sep 29 09:07:16 2005
@@ -176,16 +176,6 @@
newMessageContext.setOperationDescription(msgCtx
.getOperationDescription());
- newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, msgCtx
- .getProperty(MessageContext.TRANSPORT_OUT));
- newMessageContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
- msgCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
-
- //Setting the charater set encoding
- newMessageContext
- .setProperty(MessageContext.CHARACTER_SET_ENCODING, msgCtx
- .getProperty(MessageContext.CHARACTER_SET_ENCODING));
-
if (msgCtx.getEnvelope() != null)
newMessageContext.setEnvelope(msgCtx.getEnvelope());
@@ -214,8 +204,19 @@
msgInfoHeaders1.setMessageId(getUUID());
try {
+
MessageContext newMessageContext = new MessageContext(configCtx,
transportIn, transportOut);
+ newMessageContext.setProperty(MessageContext.TRANSPORT_OUT, msgCtx
+ .getProperty(MessageContext.TRANSPORT_OUT));
+ newMessageContext.setProperty(HTTPConstants.HTTPOutTransportInfo,
+ msgCtx.getProperty(HTTPConstants.HTTPOutTransportInfo));
+
+ //Setting the charater set encoding
+ newMessageContext
+ .setProperty(MessageContext.CHARACTER_SET_ENCODING, msgCtx
+ .getProperty(MessageContext.CHARACTER_SET_ENCODING));
+
newMessageContext.setMessageInformationHeaders(msgInfoHeaders1);
newMessageContext.setServiceDescription(msgCtx
.getServiceDescription());
---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org