Author: chamikara
Date: Thu Jun 28 20:46:21 2007
New Revision: 551787
URL: http://svn.apache.org/viewvc?view=rev&rev=551787
Log:
Some more temporary changes.
Added:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/ResponseInspector.java
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/RMMsgContext.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaInHandler.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/InvokerWorker.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/Sender.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/mar/module.xml
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/RMMsgContext.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/RMMsgContext.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/RMMsgContext.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/RMMsgContext.java
Thu Jun 28 20:46:21 2007
@@ -65,7 +65,9 @@
/**
* To add a new SOAP envelope to the message. The generated envelope
will belong
- * to the SOAP version of the MessageContext.
+ * to the SOAP version of the MessageContext. We will be going through
each MessagePart and adding it to the
+ * envelope. In other words all the MessageParts that are available in
the RMMsg will be added to the SOAP
+ * envelope after this.
*
* @throws SandeshaException
*/
@@ -105,7 +107,6 @@
public int getMessageType() {
return messageType;
}
-
/**
* The message type can be used to easily identify what this message is.
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
Thu Jun 28 20:46:21 2007
@@ -24,8 +24,10 @@
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPHeader;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.RelatesTo;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.commons.logging.Log;
@@ -150,6 +152,8 @@
String sequenceId = sequence.getIdentifier().getIdentifier();
long msgNo = sequence.getMessageNumber().getMessageNumber();
+ MessageContext msgContext = rmMsgCtx.getMessageContext();
+
StorageManager storageManager =
SandeshaUtil.getSandeshaStorageManager(rmMsgCtx.getConfigurationContext(),
rmMsgCtx.getConfigurationContext().getAxisConfiguration());
@@ -202,13 +206,33 @@
else {
if (log.isDebugEnabled())
log.debug("Detected duplicate message " + msgNo);
- rmMsgCtx.getMessageContext().setRelationships(null);
+
// Add the duplicate RM AxisOperation to the message
+
+ //If the service has not been found by this time, we cannot proceed.
+ AxisService service = rmMsgCtx.getMessageContext().getAxisService();
+ if (service==null)
+ throw new SandeshaException ("Duplicate message detected. But
cant dispatch since the Service has not been found");
+
AxisOperation duplicateMessageOperation =
SpecSpecificConstants.getWSRMOperation(
Sandesha2Constants.MessageTypes.DUPLICATE_MESSAGE,
Sandesha2Constants.SPEC_VERSIONS.v1_0,
- rmMsgCtx.getMessageContext().getAxisService());
+ service);
rmMsgCtx.getMessageContext().setAxisOperation(duplicateMessageOperation);
+
+
+ /**
+ * Adding a MessageID here if this is a response message. If this is
not added AddressingValidators will fail.
+ * This is becoz the DuplicateOperation I added here has a InOut
operation. According to Addressing a InOut msg
+ * Must contain a MessageID.
+ */
+
+ RelatesTo relatesTo = msgContext.getRelatesTo();
+ String messageID = msgContext.getOptions().getMessageId();
+ if (relatesTo!=null && messageID==null) {
+ msgContext.getOptions().setMessageId (SandeshaUtil.getUUID());
+ }
+
}
} else {
@@ -216,10 +240,16 @@
log.debug("Detected message for no sequence " + msgNo);
rmMsgCtx.getMessageContext().setRelationships(null);
// Add the duplicate RM AxisOperation to the message
+
+ //If the service has not been found by this time, we cannot proceed.
+ AxisService service = rmMsgCtx.getMessageContext().getAxisService();
+ if (service==null)
+ throw new SandeshaException ("Duplicate message detected. But cant
dispatch since the Service has not been found");
+
AxisOperation duplicateMessageOperation =
SpecSpecificConstants.getWSRMOperation(
Sandesha2Constants.MessageTypes.DUPLICATE_MESSAGE,
Sandesha2Constants.SPEC_VERSIONS.v1_0,
- rmMsgCtx.getMessageContext().getAxisService());
+ service);
rmMsgCtx.getMessageContext().setAxisOperation(duplicateMessageOperation);
}
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaInHandler.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaInHandler.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/handlers/SandeshaInHandler.java
Thu Jun 28 20:46:21 2007
@@ -102,10 +102,10 @@
RMMsgContext rmMsgCtx = null;
- if
(msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT)
!= null)
- rmMsgCtx =
(RMMsgContext)msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT);
- else
- rmMsgCtx = MsgInitializer.initializeMessage(msgCtx);
+ if
(msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT)
!= null)
+ rmMsgCtx =
(RMMsgContext)msgCtx.getProperty(Sandesha2Constants.MessageContextProperties.RM_MESSAGE_CONTEXT);
+ else
+ rmMsgCtx =
MsgInitializer.initializeMessage(msgCtx);
// validating the message
MessageValidator.validateIncomingMessage(rmMsgCtx,
storageManager);
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/AckRequestedProcessor.java
Thu Jun 28 20:46:21 2007
@@ -36,6 +36,9 @@
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.transport.mail.MailBasedOutTransportInfo;
+import org.apache.axis2.util.MessageContextBuilder;
+import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.sandesha2.RMMsgContext;
@@ -110,6 +113,7 @@
if (log.isDebugEnabled())
log.debug("Enter:
AckRequestedProcessor::processAckRequestedHeader " + soapHeader);
+ //checks weather the ack request was a piggybacked one.
boolean piggybackedAckRequest =
!(rmMsgCtx.getMessageType()==Sandesha2Constants.MessageTypes.ACK_REQUEST);
String sequenceId =
ackRequested.getIdentifier().getIdentifier();
@@ -123,7 +127,7 @@
// Check that the sender of this AckRequest holds the correct
token
RMDBean rmdBean =
SandeshaUtil.getRMDBeanFromSequenceId(storageManager, sequenceId);
- if(rmdBean != null && rmdBean.getSecurityTokenData() != null) {;
+ if(rmdBean != null && rmdBean.getSecurityTokenData() != null) {
SecurityManager secManager =
SandeshaUtil.getSecurityManager(configurationContext);
SecurityToken token =
secManager.recoverSecurityToken(rmdBean.getSecurityTokenData());
@@ -151,22 +155,28 @@
if (acksToStr == null)
throw new
SandeshaException(SandeshaMessageHelper.getMessage(SandeshaMessageKeys.acksToStrNotSet));
+ //Getting the operation for ack messages.
AxisOperation ackOperation =
SpecSpecificConstants.getWSRMOperation(
Sandesha2Constants.MessageTypes.ACK,
rmdBean.getRMVersion(),
msgContext.getAxisService());
- MessageContext ackMsgCtx =
SandeshaUtil.createNewRelatedMessageContext(rmMsgCtx, ackOperation);
-
-
ackMsgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");
-
+
+ //creating the ack message. If the ackRequest was a standalone
this will be a out (response) message
+ MessageContext ackMsgCtx = null;
+// if (piggybackedAckRequest)
+ ackMsgCtx =
SandeshaUtil.createNewRelatedMessageContext(rmMsgCtx, ackOperation);
+// else
+// ackMsgCtx
=MessageContextBuilder.createOutMessageContext (msgContext);
+
+ //setting up the RMMsgContext
RMMsgContext ackRMMsgCtx =
MsgInitializer.initializeMessage(ackMsgCtx);
ackRMMsgCtx.setRMNamespaceValue(rmMsgCtx.getRMNamespaceValue());
-
- ackMsgCtx.setMessageID(SandeshaUtil.getUUID());
-
+
+ if (ackMsgCtx.getMessageID()==null)
+ ackMsgCtx.setMessageID(SandeshaUtil.getUUID());
+
+ //adding the SOAP Envelope
SOAPFactory factory =
SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(msgContext.getEnvelope()));
-
- // Setting new envelope
SOAPEnvelope envelope = factory.getDefaultEnvelope();
try {
ackMsgCtx.setEnvelope(envelope);
@@ -177,13 +187,20 @@
ackMsgCtx.setTo(acksTo);
ackMsgCtx.setReplyTo(msgContext.getTo());
RMMsgCreator.addAckMessage(ackRMMsgCtx, sequenceId, rmdBean);
+
+ //this is not a client generated message. So set serverSide to
true.
ackRMMsgCtx.getMessageContext().setServerSide(true);
if (acksTo.hasAnonymousAddress()) {
-
+ //If acksTo is anonymous we will be sending the ack
here it self. Transport will use what ever mechanism to send the
+ //message. (for e.g. HTTP will use the back channel)
+
+
AxisEngine engine = new
AxisEngine(ackRMMsgCtx.getMessageContext().getConfigurationContext());
// setting CONTEXT_WRITTEN since acksto is anonymous
+
+ //adding an OperationContext if one is not available.
(for e.g. If we are in the SandeshaGlobalInHandler)
if (rmMsgCtx.getMessageContext().getOperationContext()
== null) {
// operation context will be null when doing in
a GLOBAL
// handler.
@@ -194,11 +211,16 @@
rmMsgCtx.getMessageContext().setOperationContext(opCtx);
}
+ //the response will be written here.
rmMsgCtx.getMessageContext().getOperationContext().setProperty(org.apache.axis2.Constants.RESPONSE_WRITTEN,
Constants.VALUE_TRUE);
+ //Marking that we did the acking here.
rmMsgCtx.getMessageContext().setProperty(Sandesha2Constants.ACK_WRITTEN,
"true");
+
+ MailBasedOutTransportInfo outTrnInfo =
(MailBasedOutTransportInfo)
ackRMMsgCtx.getMessageContext().getOptions().getProperty(Constants.OUT_TRANSPORT_INFO);
+
try {
engine.send(ackRMMsgCtx.getMessageContext());
} catch (AxisFault e1) {
@@ -206,8 +228,10 @@
}
} else {
-
- SenderBeanMgr retransmitterBeanMgr =
storageManager.getSenderBeanMgr();
+ //If AcksTo is non-anonymous we will be adding a
senderBean entry here. The sender is responsible
+ //for sending it out.
+
+ SenderBeanMgr senderBeanMgr =
storageManager.getSenderBeanMgr();
String key = SandeshaUtil.getUUID();
@@ -217,7 +241,10 @@
SenderBean ackBean = new SenderBean();
ackBean.setMessageContextRefKey(key);
ackBean.setMessageID(ackMsgCtx.getMessageID());
+
+ //acks are sent only once.
ackBean.setReSend(false);
+
ackBean.setSequenceID(sequenceId);
EndpointReference to = ackMsgCtx.getTo();
@@ -228,35 +255,25 @@
ackBean.setSend(true);
ackMsgCtx.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,
Sandesha2Constants.VALUE_FALSE);
-
ackBean.setMessageType(Sandesha2Constants.MessageTypes.ACK);
-
- // the internalSequenceId value of the retransmitter
Table for the
- // messages related to an incoming
- // sequence is the actual sequence ID
-
- // operation is the lowest level, Sandesha2 can be
engaged.
- SandeshaPolicyBean propertyBean =
SandeshaUtil.getPropertyBean(msgContext.getAxisOperation());
+ SandeshaPolicyBean propertyBean =
SandeshaUtil.getPropertyBean(msgContext.getAxisMessage());
long ackInterval =
propertyBean.getAcknowledgementInterval();
- // Ack will be sent as stand alone, only after the
retransmitter
- // interval.
+ // Ack will be sent as stand alone, only after the
ackknowledgement interval
long timeToSend = System.currentTimeMillis() +
ackInterval;
// removing old acks.
SenderBean findBean = new SenderBean();
findBean.setMessageType(Sandesha2Constants.MessageTypes.ACK);
- findBean.setSend(true);
- findBean.setReSend(false);
- Collection coll = retransmitterBeanMgr.find(findBean);
+ Collection coll = senderBeanMgr.find(findBean);
Iterator it = coll.iterator();
if (it.hasNext()) {
SenderBean oldAckBean = (SenderBean) it.next();
- // If there is an old ack. This ack will be
sent in the old timeToSend.
+ // If there is an old Ack. This Ack will be
sent in the old timeToSend.
timeToSend = oldAckBean.getTimeToSend();
-
retransmitterBeanMgr.delete(oldAckBean.getMessageID());
+ senderBeanMgr.delete(oldAckBean.getMessageID());
}
ackBean.setTimeToSend(timeToSend);
@@ -264,18 +281,19 @@
msgContext.setProperty(Sandesha2Constants.QUALIFIED_FOR_SENDING,
Sandesha2Constants.VALUE_FALSE);
// passing the message through sandesha2sender
-
SandeshaUtil.executeAndStore(ackRMMsgCtx, key);
- // inserting the new ack.
- retransmitterBeanMgr.insert(ackBean);
+ // inserting the new Ack.
+ senderBeanMgr.insert(ackBean);
msgContext.pause();
if (log.isDebugEnabled())
log.debug("Exit:
AckRequestedProcessor::processAckRequestedHeader " + Boolean.TRUE);
- return true;
+
}
+
+ //No need to suspend. Just proceed.
return false;
}
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/util/RMMsgCreator.java
Thu Jun 28 20:46:21 2007
@@ -31,6 +31,7 @@
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
+import org.apache.axis2.util.MessageContextBuilder;
import org.apache.axis2.util.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -395,10 +396,22 @@
Sandesha2Constants.MessageParts.CLOSE_SEQUENCE_RESPONSE, action);
}
+ /**
+ * This will create a response message context using the Axis2 Util
methods (where things like relatesTo transformation will
+ * happen). This will also make sure that created out message is
correctly secured using the Sequence Token Data of the sequence.
+ *
+ * @param requestMsg The request message
+ * @param rmSequenceBean
+ * @param part
+ * @param messagePartId
+ * @param action
+ * @return
+ * @throws AxisFault
+ */
private static RMMsgContext createResponseMsg(RMMsgContext requestMsg,
RMSequenceBean rmSequenceBean, IOMRMPart part,
int messagePartId, String action) throws AxisFault {
- MessageContext outMessage =
Utils.createOutMessageContext(requestMsg.getMessageContext());
+ MessageContext outMessage =
MessageContextBuilder.createOutMessageContext (requestMsg.getMessageContext());
RMMsgContext responseRMMsg = new RMMsgContext(outMessage);
SOAPFactory factory =
SOAPAbstractFactory.getSOAPFactory(SandeshaUtil.getSOAPVersion(requestMsg.getSOAPEnvelope()));
@@ -422,10 +435,10 @@
}
/**
- * Adds an ack message to the given application message.
+ * Adds an Ack of specific sequence to the given application message.
*
- * @param applicationMsg
- * @param sequenceId
+ * @param applicationMsg The Message to which the Ack will be added
+ * @param sequenceId - The sequence to which we will be Acking
* @throws SandeshaException
*/
public static void addAckMessage(RMMsgContext applicationMsg, String
sequenceId, RMDBean rmdBean)
@@ -531,6 +544,14 @@
return makeConnectionRMMessageCtx;
}
+ /**
+ * This will add necessary data to a out-bound message to make sure
that is is correctly secured.
+ * Security Token Data will be taken from the Sandesha2 security
manager.
+ *
+ * @param rmBean Sequence bean to identify the sequence. This could be
an in-bound sequence or an out-bound sequence.
+ * @param message - The message which will be secured.
+ * @throws SandeshaException
+ */
public static void secureOutboundMessage(RMSequenceBean rmBean,
MessageContext message)
throws SandeshaException
{
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/InvokerWorker.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/InvokerWorker.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/InvokerWorker.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/InvokerWorker.java
Thu Jun 28 20:46:21 2007
@@ -158,6 +158,8 @@
} catch (Exception e) {
if (log.isErrorEnabled())
log.error(e.toString(), e);
+
+ e.printStackTrace();
} finally {
if (workId !=null && lock!=null) {
lock.removeWork(workId);
Added:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/ResponseInspector.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/ResponseInspector.java?view=auto&rev=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/ResponseInspector.java
(added)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/ResponseInspector.java
Thu Jun 28 20:46:21 2007
@@ -0,0 +1,127 @@
+package org.apache.sandesha2.workers;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.client.OperationClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.OutInAxisOperation;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.TransportUtils;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.Utils;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.sandesha2.Sandesha2Constants;
+
+/**
+ *
+ *This will use a OutInOperationClient to send a message out and check for a
response.
+ */
+public class ResponseInspector {
+
+ private static final Log log =
LogFactory.getLog(ResponseInspector.class);
+
+ /**
+ * To send a message out and look for a response. No changes will be
done to the operation
+ *
+ * @param messageContext
+ * @throws AxisFault
+ */
+ public static MessageContext checkForSyncResponse (MessageContext
outMessageContext) throws AxisFault {
+
+
+ OperationContext outOperationContext =
outMessageContext.getOperationContext();
+ ConfigurationContext configurationContext =
outMessageContext.getConfigurationContext();
+ Options outMessageOptions = outMessageContext.getOptions();
+
+ MessageContext inMessageContext =
outOperationContext.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+
+ //If an incoming message is not present, we create one here.
+ if (inMessageContext==null)
+ inMessageContext =
ContextFactory.createMessageContext(configurationContext);
+
+ //generating the envelope for the InMessage
+ if (inMessageContext.getEnvelope()==null) {
+ configureInMessage (inMessageContext,
outMessageContext);
+ SOAPEnvelope inMessageEnvelope =
TransportUtils.createSOAPMessage(inMessageContext);
+ inMessageContext.setEnvelope(inMessageEnvelope);
+ }
+
+ //do any possible dispatching here
+ doSyncDispatching (inMessageContext, outMessageContext);
+
+ return inMessageContext;
+ }
+
+
+ private static void configureInMessage (MessageContext
inMessageContext,MessageContext outMessageContext) {
+
+
inMessageContext.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
outMessageContext
+
.getProperty(Constants.Configuration.CHARACTER_SET_ENCODING));
+
inMessageContext.setProperty(Constants.Configuration.CONTENT_TYPE,
outMessageContext
+
.getProperty(Constants.Configuration.CONTENT_TYPE));
+
inMessageContext.setProperty(HTTPConstants.MTOM_RECEIVED_CONTENT_TYPE,
outMessageContext
+
.getProperty(HTTPConstants.MTOM_RECEIVED_CONTENT_TYPE));
+ inMessageContext.setProperty(MessageContext.TRANSPORT_IN,
+
outMessageContext.getProperty(MessageContext.TRANSPORT_IN));
+
inMessageContext.setProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY,
+
outMessageContext.getProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY));
+
inMessageContext.setProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY,
+
outMessageContext.getProperty(Sandesha2Constants.MessageContextProperties.MAKECONNECTION_ENTRY));
+
+ inMessageContext.setDoingREST(outMessageContext.isDoingREST());
+ }
+
+ private static void doSyncDispatching (MessageContext
outMessageContext, MessageContext inMessageContext) throws AxisFault {
+
+ //we assume the sync response to belong to the same AxisService
and the ServiceContext, but not necessarily
+ //to the same operation.
+
inMessageContext.setConfigurationContext(outMessageContext.getConfigurationContext());
+
inMessageContext.setTransportIn(outMessageContext.getTransportIn());
+
inMessageContext.setTransportOut(outMessageContext.getTransportOut());
+
inMessageContext.setAxisService(outMessageContext.getAxisService());
+
inMessageContext.setAxisServiceGroup(outMessageContext.getAxisServiceGroup());
+
inMessageContext.setServiceContext(outMessageContext.getServiceContext());
+
inMessageContext.setServiceGroupContext(outMessageContext.getServiceGroupContext());
+
+ Boolean addressingDisabled = (Boolean)
outMessageContext.getOptions().getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ if (addressingDisabled!=null &&
Boolean.TRUE.equals(addressingDisabled)) {
+
+ OperationContext outOperationContext =
outMessageContext.getOperationContext();
+ OperationContext inOperationContext = null;
+ if
(outOperationContext.getAxisOperation().getMessageReceiver() == null) {
+ // If the AxisOperation object doesn't have a
message receiver, it means that this was
+ // an OutOnlyOp where a sync response has been
added possibly in the RM layer.
+
+ AxisOperation op =
outMessageContext.getAxisService().getOperation(Sandesha2Constants.RM_IN_ONLY_OPERATION);
+ inOperationContext =
ContextFactory.createOperationContext (op,
outMessageContext.getServiceContext());
+ } else {
+ //else this must be a sync response
+ inOperationContext = outOperationContext;
+ }
+
+
inMessageContext.setOperationContext(inOperationContext);
+ inOperationContext.addMessageContext(inMessageContext);
+ }
+
+ //if the operation has been set we set the Message as well
+ AxisOperation operation = inMessageContext.getAxisOperation();
+ if (operation!=null) {
+
inMessageContext.setAxisMessage(operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
+ }
+ }
+
+}
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/Sender.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/Sender.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/Sender.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/Sender.java
Thu Jun 28 20:46:21 2007
@@ -404,7 +404,7 @@
if (inMsg != null)
t = (RequestResponseTransport)
inMsg.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
- if((t != null ||
!t.getStatus().equals(RequestResponseTransportStatus.WAITING))) {
+ if((t != null &&
!t.getStatus().equals(RequestResponseTransportStatus.WAITING))) {
if(log.isWarnEnabled()) {
String message =
SandeshaMessageHelper.getMessage(SandeshaMessageKeys.freeingTransport);
log.warn(message);
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
Thu Jun 28 20:46:21 2007
@@ -17,6 +17,7 @@
import org.apache.axis2.context.ServiceContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.OutInAxisOperation;
+import org.apache.axis2.description.OutOnlyAxisOperation;
import org.apache.axis2.engine.AxisEngine;
import org.apache.axis2.engine.Handler.InvocationResponse;
import org.apache.axis2.transport.RequestResponseTransport;
@@ -273,7 +274,6 @@
if (log.isDebugEnabled())
log.debug("Resuming a
send for message : "
+
msgCtx.getEnvelope().getHeader());
- System.out.println("resume send
called....");
response =
engine.resumeSend(msgCtx);
}
@@ -654,15 +654,15 @@
AxisOperation operation =
msgCtx.getAxisOperation();
if (operation!=null &&
responseMessageContext.getAxisMessage()==null
- && (operation instanceof
OutInAxisOperation))
+ && !(operation instanceof
OutOnlyAxisOperation))
responseMessageContext.setAxisMessage(operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE));
- RMMsgContext responseRMMessage =
MsgInitializer.initializeMessage(responseMessageContext);
- if
(responseRMMessage.getMessageType()==Sandesha2Constants.MessageTypes.ACK) {
-
responseMessageContext.setAxisOperation(SpecSpecificConstants.getWSRMOperation
-
(Sandesha2Constants.MessageTypes.ACK, responseRMMessage.getRMSpecVersion(),
responseMessageContext.getAxisService()));
-
responseMessageContext.setOperationContext(null);
- }
+// RMMsgContext responseRMMessage =
MsgInitializer.initializeMessage(responseMessageContext);
+// if
(responseRMMessage.getMessageType()==Sandesha2Constants.MessageTypes.ACK) {
+//
responseMessageContext.setAxisOperation(SpecSpecificConstants.getWSRMOperation
+//
(Sandesha2Constants.MessageTypes.ACK, responseRMMessage.getRMSpecVersion(),
responseMessageContext.getAxisService()));
+//
responseMessageContext.setOperationContext(null);
+// }
}
@@ -698,6 +698,9 @@
//So we have to add a empty SOAPAction here.
responseMessageContext.setSoapAction("");
}
+
+ //do any possible dispatching before invocation - see
the commment before the method.
+ doSyncDispatching (responseMessageContext, msgCtx);
AxisEngine engine = new
AxisEngine(msgCtx.getConfigurationContext());
if (resenvelope!=null) {
@@ -731,6 +734,23 @@
if (log.isDebugEnabled())
log.debug("Exit: SenderWorker::isFaultEnvelope, FALSE");
return false;
+ }
+
+
+ //had to do this due to a problem with security in 1.1
+ //Security was depending on ServiceContext in the client side, and this
was causing a security failure for msgs
+ //that does not get with addressing. Such as Acks, LastMessage and
TerminateSequence. This was fixed by doing a hack to
+ //do instance dispatching here. Upto the service context level. In
Rampart trunk this has been correctly fixed.
+ private void doSyncDispatching (MessageContext responseMessage,
MessageContext requestMessage) {
+ if (requestMessage.getServiceGroupContext()!=null) {
+
responseMessage.setAxisServiceGroup(requestMessage.getAxisServiceGroup());
+
responseMessage.setServiceGroupContext(requestMessage.getServiceGroupContext());
+ }
+
+ if (requestMessage.getServiceContext()!=null) {
+
responseMessage.setAxisService(requestMessage.getAxisService());
+
responseMessage.setServiceContext(requestMessage.getServiceContext());
+ }
}
}
Modified:
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/mar/module.xml
URL:
http://svn.apache.org/viewvc/webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/mar/module.xml?view=diff&rev=551787&r1=551786&r2=551787
==============================================================================
---
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/mar/module.xml
(original)
+++
webservices/sandesha/branches/sandesha2/java/temp/post_1_2/modules/mar/module.xml
Thu Jun 28 20:46:21 2007
@@ -5,15 +5,16 @@
</Description>
<InFlow>
+
+ <handler name="SequenceIDDispatcher"
class="org.apache.sandesha2.handlers.SequenceIDDispatcher">
+ <order phase="PreDispatch" />
+ </handler>
+
<handler name="SandeshaGlobalInHandler"
class="org.apache.sandesha2.handlers.SandeshaGlobalInHandler">
<!-- Global In handler should come before addressing dispatching
-->
- <order phase="Dispatch" before="AddressingBasedDispatcher" />
+ <order phase="SandeshaGlobalHandlerPhase" />
</handler>
- <handler name="SequenceIDDispatcher"
class="org.apache.sandesha2.handlers.SequenceIDDispatcher">
- <order phase="PreDispatch" after="SandeshaGlobalInHandler"
before="AddressingBasedDispatcher" />
- </handler>
-
<handler name="SandeshaInHandler"
class="org.apache.sandesha2.handlers.SandeshaInHandler">
<order phase="RMPhase"/>
</handler>
@@ -55,6 +56,7 @@
<actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/fault</actionMapping>
<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/TerminateSequence</actionMapping>
+
<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested</actionMapping>
</operation>
<operation name="Sandesha2OperationInOut"
mep="http://www.w3.org/2006/01/wsdl/in-out">
@@ -62,7 +64,6 @@
<!-- namespaces for the 2005-02 spec -->
<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</actionMapping>
-
<actionMapping>http://schemas.xmlsoap.org/ws/2005/02/rm/AckRequested</actionMapping>
<actionMapping>http://docs.oasis-open.org/ws-rx/wsrm/200702/AckRequested</actionMapping>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]