Author: ruwan
Date: Wed Mar 4 17:28:56 2009
New Revision: 750085
URL: http://svn.apache.org/viewvc?rev=750085&view=rev
Log:
Fixing the addressing issue - applying the patch from Amila
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java?rev=750085&r1=750084&r2=750085&view=diff
==============================================================================
---
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
(original)
+++
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
Wed Mar 4 17:28:56 2009
@@ -33,12 +33,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.FaultHandler;
+import org.apache.synapse.ServerManager;
import org.apache.synapse.SynapseConstants;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.audit.statistics.StatisticsReporter;
import org.apache.synapse.audit.AuditConfigurable;
-import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.audit.statistics.StatisticsReporter;
import org.apache.synapse.config.SynapseConfigUtils;
+import org.apache.synapse.config.SynapseConfiguration;
import org.apache.synapse.endpoints.Endpoint;
import org.apache.synapse.endpoints.dispatch.Dispatcher;
import org.apache.synapse.transport.nhttp.NhttpConstants;
@@ -264,6 +265,26 @@
org.apache.axis2.Constants.VALUE_TRUE);
}
+ // when axis2 receives a soap message without addressing headers
it users
+ // DISABLE_ADDRESSING_FOR_OUT_MESSAGES property to keep it and
hence avoid addressing
+ // headers on the response. this causes a problem for synapse if
the original message
+ // it receivs (from client) has addressing and the synaspse
service invocation has not
+ // engage addressing. in this case when synapse receives the
response from the server
+ // addessing In handler dissable addressing since that response
does not have addressing
+ // headers. synapse sends the response to its orignal client using
the same message
+ // context. Then this response does not have addressing headers
since it already
+ // disable. to avoid this we need to set the
DISABLE_ADDRESSING_FOR_OUT_MESSAGES
+ // property state to original state.
+ if (axisOutMsgCtx.getProperty(
+ AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES)
!= null) {
+
+
response.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
+ axisOutMsgCtx.getProperty(
+
AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES));
+ } else {
+
response.removeProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+ }
+
// copy the message type property thats used by the out message
to the response message
response.setProperty(org.apache.axis2.Constants.Configuration.MESSAGE_TYPE,
axisOutMsgCtx.getProperty(org.apache.axis2.Constants.Configuration.MESSAGE_TYPE));