You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ch...@apache.org on 2007/04/17 14:29:00 UTC
svn commit: r529577 - in
/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse:
core/axis2/Axis2FlexibleMEPClient.java endpoints/AddressEndpoint.java
endpoints/WSDLEndpoint.java
Author: chathura_ce
Date: Tue Apr 17 05:28:59 2007
New Revision: 529577
URL: http://svn.apache.org/viewvc?view=rev&rev=529577
Log:
Changed code to add endpoint specific details only to the cloned message context.
And some minor fixes.
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AddressEndpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java?view=diff&rev=529577&r1=529576&r2=529577
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/Axis2FlexibleMEPClient.java Tue Apr 17 05:28:59 2007
@@ -32,6 +32,7 @@
import org.apache.axis2.AxisFault;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.OperationClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.context.ConfigurationContext;
@@ -49,6 +50,7 @@
import org.apache.neethi.PolicyEngine;
import org.apache.synapse.Constants;
import org.apache.synapse.SynapseException;
+import org.apache.synapse.statistics.impl.EndPointStatisticsStack;
import org.apache.synapse.endpoints.utils.EndpointDefinition;
/**
@@ -100,28 +102,51 @@
// we need to create the response to the original message later on
MessageContext axisOutMsgCtx = cloneForSend(originalInMsgCtx);
- if (endpoint != null) {
+ // set all the details of the endpoint only to the cloned message context
+ // so that we can use the original message context for resending through different endpoints
+ String eprAddress = null;
+ if (endpoint != null && endpoint.getAddress() != null) {
+
+ eprAddress = endpoint.getAddress().toString();
+
if (endpoint.isForcePOX()) {
axisOutMsgCtx.setDoingREST(true);
} else if (endpoint.isForceSOAP()) {
axisOutMsgCtx.setDoingREST(false);
+ if (axisOutMsgCtx.getSoapAction() == null && axisOutMsgCtx.getWSAAction() != null) {
+ axisOutMsgCtx.setSoapAction(axisOutMsgCtx.getWSAAction());
+ }
}
if (endpoint.isUseMTOM()) {
axisOutMsgCtx.setDoingMTOM(true);
+ // fix / workaround for AXIS2-1798
+ axisOutMsgCtx.setProperty(
+ org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
+ org.apache.axis2.Constants.VALUE_TRUE);
+
} else if (endpoint.isUseSwa()) {
axisOutMsgCtx.setDoingSwA(true);
+ // fix / workaround for AXIS2-1798
+ axisOutMsgCtx.setProperty(
+ org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
+ org.apache.axis2.Constants.VALUE_TRUE);
}
if (endpoint.isUseSeparateListener()) {
axisOutMsgCtx.setProperty(Constants.OUTFLOW_USE_SEPARATE_LISTENER, Boolean.TRUE);
}
+
+ axisOutMsgCtx.setTo(new EndpointReference(eprAddress));
}
if (wsAddressingEnabled) {
- axisOutMsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);
+ axisOutMsgCtx.setProperty
+ (AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);
+
} else {
- axisOutMsgCtx.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+ axisOutMsgCtx.setProperty
+ (AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
}
ConfigurationContext axisCfgCtx = axisOutMsgCtx.getConfigurationContext();
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AddressEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AddressEndpoint.java?view=diff&rev=529577&r1=529576&r2=529577
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AddressEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/AddressEndpoint.java Tue Apr 17 05:28:59 2007
@@ -132,88 +132,46 @@
this.active = active;
}
- public void send(MessageContext synCtx) {
+ /**
+ * Sends the message through this endpoint. This method just handles statistics related functions
+ * and gives the message to the Synapse environment to send. It does not add any endpoint
+ * specific details to the message context. These details are added only to the cloned message
+ * context by the Axis2FlexibleMepClient. So that we can reuse the original message context for
+ * resending through different endpoints.
+ *
+ * @param synCtx MessageContext sent by client to Synapse
+ */
+ public void send(MessageContext synCtx) {
+
+ String endPointName = this.getName();
+
+ // Setting Required property to collect the End Point statistics
+ boolean statisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON == endpoint.getStatisticsEnable());
+ if (endPointName != null && statisticsEnable) {
+ EndPointStatisticsStack endPointStatisticsStack = new EndPointStatisticsStack();
+ boolean isFault =synCtx.getEnvelope().getBody().hasFault();
+ endPointStatisticsStack.put(endPointName, System.currentTimeMillis(), !synCtx.isResponse(), statisticsEnable,isFault);
+ synCtx.setProperty(org.apache.synapse.Constants.ENDPOINT_STATISTICS_STACK, endPointStatisticsStack);
+ }
- String eprAddress = null;
if (endpoint.getAddress() != null) {
- eprAddress = endpoint.getAddress().toString();
-
- if (endpoint.isForcePOX()) {
- synCtx.setDoingPOX(true);
- } else if (endpoint.isForceSOAP()) {
- synCtx.setDoingPOX(false);
- }
-
- if (endpoint.isUseMTOM()) {
- synCtx.setDoingMTOM(true);
- // fix / workaround for AXIS2-1798
- ((Axis2MessageContext) synCtx).getAxis2MessageContext().setProperty(
- org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
- org.apache.axis2.Constants.VALUE_TRUE);
- } else if (endpoint.isUseSwa()) {
- synCtx.setDoingSWA(true);
- // fix / workaround for AXIS2-1798
- ((Axis2MessageContext) synCtx).getAxis2MessageContext().setProperty(
- org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
- org.apache.axis2.Constants.VALUE_TRUE);
- }
-
- if (endpoint.isUseSeparateListener()) {
- synCtx.setProperty(Constants.OUTFLOW_USE_SEPARATE_LISTENER, Boolean.TRUE);
- }
-
- String endPointName = this.getName();
-
- // Setting Required property to collect the End Point statistics
- boolean statisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON == endpoint.getStatisticsEnable());
- if (endPointName != null && statisticsEnable) {
- EndPointStatisticsStack endPointStatisticsStack = new EndPointStatisticsStack();
- boolean isFault =synCtx.getEnvelope().getBody().hasFault();
- endPointStatisticsStack.put(endPointName, System.currentTimeMillis(), !synCtx.isResponse(), statisticsEnable,isFault);
- synCtx.setProperty(org.apache.synapse.Constants.ENDPOINT_STATISTICS_STACK, endPointStatisticsStack);
- }
- synCtx.setTo(new EndpointReference(eprAddress));
-
if (log.isDebugEnabled()) {
log.debug("Sending message to endpoint :: name = " +
- endPointName + " resolved address = " + eprAddress);
+ endPointName + " resolved address = " + endpoint.getAddress().toString());
log.debug("Sending To: " + (synCtx.getTo() != null ?
synCtx.getTo().getAddress() : "null"));
- log.debug("SOAPAction: " + (synCtx.getWSAAction() != null ?
+ log.debug("SOAPAction: " + (synCtx.getSoapAction() != null ?
+ synCtx.getSoapAction() : "null"));
+ log.debug("WSA-Action: " + (synCtx.getWSAAction() != null ?
synCtx.getWSAAction() : "null"));
log.debug("Body : \n" + synCtx.getEnvelope());
}
+ }
- // if RM is turned on
- if (endpoint.isReliableMessagingOn()) {
- synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON, Boolean.TRUE);
- synCtx.setProperty(Constants.OUTFLOW_RM_ON, Boolean.TRUE);
- if (endpoint.getWsRMPolicyKey() != null) {
- synCtx.setProperty(Constants.OUTFLOW_RM_POLICY,
- endpoint.getWsRMPolicyKey());
- }
- }
-
- // if WS Security is specified
- if (endpoint.isSecurityOn()) {
- synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON, Boolean.TRUE);
- synCtx.setProperty(Constants.OUTFLOW_SECURITY_ON, Boolean.TRUE);
- if (endpoint.getWsSecPolicyKey() != null) {
- synCtx.setProperty(Constants.OUTFLOW_SEC_POLICY,
- endpoint.getWsSecPolicyKey());
- }
- }
-
- // if WS Addressing is specified
- if (endpoint.isAddressingOn()) {
- synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON, Boolean.TRUE);
- }
-
- // register this as the immediate fault handler for this message.
- synCtx.pushFaultHandler(this);
+ // register this as the immediate fault handler for this message.
+ synCtx.pushFaultHandler(this);
- synCtx.getEnvironment().send(endpoint, synCtx);
- }
+ synCtx.getEnvironment().send(endpoint, synCtx);
}
public void onChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext) {
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java?view=diff&rev=529577&r1=529576&r2=529577
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/WSDLEndpoint.java Tue Apr 17 05:28:59 2007
@@ -67,36 +67,21 @@
private Endpoint parentEndpoint = null;
private EndpointDefinition endpointDefinition = null;
+ /**
+ * Sends the message through this endpoint. This method just handles statistics related functions
+ * and gives the message to the Synapse environment to send. It does not add any endpoint
+ * specific details to the message context. These details are added only to the cloned message
+ * context by the Axis2FlexibleMepClient. So that we can reuse the original message context for
+ * resending through different endpoints.
+ *
+ * @param synCtx MessageContext sent by client to Synapse
+ */
public void send(MessageContext synCtx) {
String eprAddress = null;
if (endpointDefinition.getAddress() != null) {
eprAddress = endpointDefinition.getAddress().toString();
- if (endpointDefinition.isForcePOX()) {
- synCtx.setDoingPOX(true);
- } else if (endpointDefinition.isForceSOAP()) {
- synCtx.setDoingPOX(false);
- }
-
- if (endpointDefinition.isUseMTOM()) {
- synCtx.setDoingMTOM(true);
- // fix / workaround for AXIS2-1798
- ((Axis2MessageContext) synCtx).getAxis2MessageContext().setProperty(
- org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
- org.apache.axis2.Constants.VALUE_TRUE);
- } else if (endpointDefinition.isUseSwa()) {
- synCtx.setDoingSWA(true);
- // fix / workaround for AXIS2-1798
- ((Axis2MessageContext) synCtx).getAxis2MessageContext().setProperty(
- org.apache.axis2.Constants.Configuration.ENABLE_MTOM,
- org.apache.axis2.Constants.VALUE_TRUE);
- }
-
- if (endpointDefinition.isUseSeparateListener()) {
- synCtx.setProperty(Constants.OUTFLOW_USE_SEPARATE_LISTENER, Boolean.TRUE);
- }
-
String endPointName = this.getName();
// Setting Required property to collect the End Point statistics
@@ -107,41 +92,17 @@
endPointStatisticsStack.put(endPointName, System.currentTimeMillis(), !synCtx.isResponse(), statisticsEnable,isFault);
synCtx.setProperty(org.apache.synapse.Constants.ENDPOINT_STATISTICS_STACK, endPointStatisticsStack);
}
- synCtx.setTo(new EndpointReference(eprAddress));
if (log.isDebugEnabled()) {
log.debug("Sending message to endpoint :: name = " +
endPointName + " resolved address = " + eprAddress);
log.debug("Sending To: " + (synCtx.getTo() != null ?
synCtx.getTo().getAddress() : "null"));
- log.debug("SOAPAction: " + (synCtx.getWSAAction() != null ?
+ log.debug("SOAPAction: " + (synCtx.getSoapAction() != null ?
+ synCtx.getSoapAction() : "null"));
+ log.debug("WSA-Action: " + (synCtx.getWSAAction() != null ?
synCtx.getWSAAction() : "null"));
log.debug("Body : \n" + synCtx.getEnvelope());
- }
-
- // if RM is turned on
- if (endpointDefinition.isReliableMessagingOn()) {
- synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON, Boolean.TRUE);
- synCtx.setProperty(Constants.OUTFLOW_RM_ON, Boolean.TRUE);
- if (endpointDefinition.getWsRMPolicyKey() != null) {
- synCtx.setProperty(Constants.OUTFLOW_RM_POLICY,
- endpointDefinition.getWsRMPolicyKey());
- }
- }
-
- // if WS Security is specified
- if (endpointDefinition.isSecurityOn()) {
- synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON, Boolean.TRUE);
- synCtx.setProperty(Constants.OUTFLOW_SECURITY_ON, Boolean.TRUE);
- if (endpointDefinition.getWsSecPolicyKey() != null) {
- synCtx.setProperty(Constants.OUTFLOW_SEC_POLICY,
- endpointDefinition.getWsSecPolicyKey());
- }
- }
-
- // if WS Addressing is specified
- if (endpointDefinition.isAddressingOn()) {
- synCtx.setProperty(Constants.OUTFLOW_ADDRESSING_ON, Boolean.TRUE);
}
synCtx.pushFaultHandler(this);
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org