Author: azeez Date: Sat Mar 26 20:20:49 2011 New Revision: 1085796 URL: http://svn.apache.org/viewvc?rev=1085796&view=rev Log: Added in MessageContext as a property in the out/fault MessageContexts. This is needed in cases where an OperationContext is not created, for example, since the request never gets dispatched to the service operation, either due to a security failure or a request coming non-existing endpoint. A use case for this is a SOAP Tracer module which shows messages coming and and responses going out. If a WS-Security validation fails or if the request never gets dispatched to a service, and OperationContext will never get created, hence in the OutFlow, it will not be possible to access the in flow MessageContext. With this change, such thigns will be possible.
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/context/MessageContext.java axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/context/MessageContext.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/context/MessageContext.java?rev=1085796&r1=1085795&r2=1085796&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/context/MessageContext.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/context/MessageContext.java Sat Mar 26 20:20:49 2011 @@ -180,6 +180,14 @@ public class MessageContext extends Abst public static final String TRANSPORT_ADDR = "TRANSPORT_ADDR"; public static final String TRANSPORT_HEADERS = "TRANSPORT_HEADERS"; + /** + * Constant used as the key for the property which stores the In MessageContext in the + * Out MessageContext/FaultMessageContext. This is needed in cases where an OperationContext + * is not created, for example, since the request never gets dispatched to the service + * operation, either due to a security failure or a request coming in for a non-existing + * endpoint + */ + public static final String IN_MESSAGE_CONTEXT = "axis2.inMsgContext"; /** * message attachments Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java?rev=1085796&r1=1085795&r2=1085796&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java Sat Mar 26 20:20:49 2011 @@ -81,6 +81,7 @@ public class MessageContextBuilder { newmsgCtx.setTransportIn(inMessageContext.getTransportIn()); newmsgCtx.setTransportOut(inMessageContext.getTransportOut()); newmsgCtx.setServerSide(inMessageContext.isServerSide()); + newmsgCtx.setProperty(MessageContext.IN_MESSAGE_CONTEXT, inMessageContext); // TODO: Should this be specifying (or defaulting to) the "response" relationshipType?? newmsgCtx.addRelatesTo(new RelatesTo(inMessageContext.getOptions().getMessageId()));