synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asan...@apache.org
Subject svn commit: r581173 - in /webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse: ./ config/xml/endpoints/ config/xml/endpoints/utils/ core/axis2/ endpoints/utils/
Date Tue, 02 Oct 2007 09:38:37 GMT
Author: asankha
Date: Tue Oct  2 02:38:37 2007
New Revision: 581173

URL: http://svn.apache.org/viewvc?rev=581173&view=rev
Log:
apply patch from Upul for http://issues.apache.org/jira/browse/SYNAPSE-91

Modified:
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointSerializer.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointFactory.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointSerializer.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/WSDL11EndpointBuilder.java
    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/core/axis2/SynapseCallbackReceiver.java
    webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/SynapseConstants.java
Tue Oct  2 02:38:37 2007
@@ -205,4 +205,9 @@
 
     /** A name to use for anonymous sequences in the sequence stack */
     public static final String ANONYMOUS_SEQUENCES = "AnonymousSequences";
+    
+    /** Message format values in EndpointDefinition. Used by address, wsdl endpoints */
+    public static final String FORMAT_POX = "pox";
+    public static final String FORMAT_SOAP11 = "soap11";
+    public static final String FORMAT_SOAP12 = "soap12";    
 }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
Tue Oct  2 02:38:37 2007
@@ -157,12 +157,20 @@
         if (format != null)
         {
             String forceValue = format.getAttributeValue().trim().toLowerCase();
-            if (forceValue.equals("pox")) {
+            if (forceValue.equals(SynapseConstants.FORMAT_POX)) {
                 endpoint.setForcePOX(true);
-            } else if (forceValue.equals("soap")) {
-                endpoint.setForceSOAP(true);
+                endpoint.setFormat(SynapseConstants.FORMAT_POX);
+                
+            } else if (forceValue.equals(SynapseConstants.FORMAT_SOAP11)) {
+            	endpoint.setForceSOAP(true);
+            	endpoint.setFormat(SynapseConstants.FORMAT_SOAP11);
+                
+            } else if (forceValue.equals(SynapseConstants.FORMAT_SOAP12)) {
+            	endpoint.setForceSOAP(true);
+                endpoint.setFormat(SynapseConstants.FORMAT_SOAP12);
+                
             } else {
-                handleException("force value -\""+forceValue+"\" not yet implemented");
+                handleException("unknown value -\""+forceValue+"\". Attribute 'format' accepts
only 'pox','soap11','soap12'");
             }
         }
 

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointSerializer.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointSerializer.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointSerializer.java
Tue Oct  2 02:38:37 2007
@@ -106,11 +106,23 @@
 
         OMElement address = fac.createOMElement("address", SynapseConstants.SYNAPSE_OMNAMESPACE);
 
-        if (endpt.isForcePOX()) {
+        if (SynapseConstants.FORMAT_POX.equals(endpt.getFormat())) {
+        	address.addAttribute(fac.createOMAttribute("format", null, "pox"));
+        	
+        } else if (SynapseConstants.FORMAT_SOAP11.equals(endpt.getFormat())) {
+            address.addAttribute(fac.createOMAttribute("format", null, "soap11"));
+        	
+        } else if (SynapseConstants.FORMAT_SOAP12.equals(endpt.getFormat())) {
+            address.addAttribute(fac.createOMAttribute("format", null, "soap12"));
+        
+        	// following two kept for backward compatibility
+        } else if (endpt.isForcePOX()) {
             address.addAttribute(fac.createOMAttribute("format", null, "pox"));
+            
         } else if (endpt.isForceSOAP()) {
-            address.addAttribute(fac.createOMAttribute("format", null, "soap"));
+            address.addAttribute(fac.createOMAttribute("format", null, "soap11"));
         }
+        
         if (endpt.isUseSwa()) {
             address.addAttribute(fac.createOMAttribute("optimize", null, "swa"));
         } else if (endpt.isUseMTOM()) {

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointFactory.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointFactory.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointFactory.java
Tue Oct  2 02:38:37 2007
@@ -211,10 +211,18 @@
         if (format != null)
         {
             String forceValue = format.getAttributeValue().trim().toLowerCase();
-            if (forceValue.equals("pox")) {
+            if (SynapseConstants.FORMAT_POX.equals(forceValue)) {
                 endpointDefinition.setForcePOX(true);
-            } else if (forceValue.equals("soap")) {
+                endpointDefinition.setFormat(SynapseConstants.FORMAT_POX);
+
+            } else if (SynapseConstants.FORMAT_SOAP11.equals(forceValue)) {
                 endpointDefinition.setForceSOAP(true);
+                endpointDefinition.setFormat(SynapseConstants.FORMAT_SOAP11);
+                
+            } else if (SynapseConstants.FORMAT_SOAP12.equals(forceValue)) {
+                endpointDefinition.setForceSOAP(true);
+                endpointDefinition.setFormat(SynapseConstants.FORMAT_SOAP12);
+                
             } else {
                 handleException("force value -\""+forceValue+"\" not yet implemented");
             }

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointSerializer.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointSerializer.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/WSDLEndpointSerializer.java
Tue Oct  2 02:38:37 2007
@@ -108,12 +108,23 @@
     public void serializeQOSInformation
             (EndpointDefinition endpointDefinition, OMElement wsdlElement) {
 
-        if (endpointDefinition.isForcePOX()) {
+        if (SynapseConstants.FORMAT_POX.equals(endpointDefinition.getFormat())) {
             wsdlElement.addAttribute(fac.createOMAttribute("format", null, "pox"));
+            
+        } else if (SynapseConstants.FORMAT_SOAP11.equals(endpointDefinition.getFormat()))
{
+            wsdlElement.addAttribute(fac.createOMAttribute("format", null, "soap11"));
+            
+        } else if (SynapseConstants.FORMAT_SOAP12.equals(endpointDefinition.getFormat()))
{
+            wsdlElement.addAttribute(fac.createOMAttribute("format", null, "soap12"));
+        
+            // following two kept for backward compatibility
+        } else if (endpointDefinition.isForcePOX()) {
+            wsdlElement.addAttribute(fac.createOMAttribute("format", null, "pox"));
+            
         } else if (endpointDefinition.isForceSOAP()) {
-            wsdlElement.addAttribute(fac.createOMAttribute("format", null, "soap"));
-        }
-
+            wsdlElement.addAttribute(fac.createOMAttribute("format", null, "soap11"));
+        }        
+        
         int isEnableStatistics = endpointDefinition.getStatisticsEnable();
         String statisticsValue = null;
         if (isEnableStatistics == org.apache.synapse.SynapseConstants.STATISTICS_ON) {

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/WSDL11EndpointBuilder.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/WSDL11EndpointBuilder.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/WSDL11EndpointBuilder.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/utils/WSDL11EndpointBuilder.java
Tue Oct  2 02:38:37 2007
@@ -20,6 +20,7 @@
 package org.apache.synapse.config.xml.endpoints.utils;
 
 import org.apache.synapse.endpoints.utils.EndpointDefinition;
+import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.SynapseException;
 import org.apache.axiom.om.OMElement;
 import org.apache.commons.logging.Log;
@@ -124,6 +125,9 @@
 
 
         String serviceURL = null;
+        // get soap version from wsdl port and update endpoint definition below
+        // so that correct soap version is used when endpoint is called
+        String format = null; 
         String tns = definition.getTargetNamespace();
         Service service = definition.getService(new QName(tns, serviceName));
         if (service != null) {
@@ -135,10 +139,12 @@
                     if (o instanceof SOAPAddress) {
                         SOAPAddress address = (SOAPAddress) o;
                         serviceURL = address.getLocationURI();
+                        format = SynapseConstants.FORMAT_SOAP11;
                         break;
                     } else if (o instanceof SOAP12Address) {
                         SOAP12Address address = (SOAP12Address) o;
                         serviceURL = address.getLocationURI();
+                        format = SynapseConstants.FORMAT_SOAP12;
                         break;
                     }
                 }
@@ -148,7 +154,8 @@
         if (serviceURL != null) {
             EndpointDefinition endpointDefinition = new EndpointDefinition();
             endpointDefinition.setAddress(serviceURL);
-
+            endpointDefinition.setFormat(format);
+            
             // todo: determine this using wsdl and policy                               
    
 
             return endpointDefinition;

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?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- 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 Oct  2 02:38:37 2007
@@ -103,6 +103,7 @@
                 (endpoint != null ?
                     "] [ mtom = " + endpoint.isUseMTOM() +
                     "] [ swa = " + endpoint.isUseSwa() +
+                    "] [ format = " + endpoint.getFormat() +                    
                     "] [ force soap=" + endpoint.isForceSOAP() +
                     "; pox=" + endpoint.isForcePOX() : "") +
                 "] [ to " + synapseOutMessageContext.getTo() + "]");
@@ -119,14 +120,27 @@
         // so that we can use the original message context for resending through different
endpoints
         if (endpoint != null) {
 
-            if (endpoint.isForcePOX()) {
+            if (SynapseConstants.FORMAT_POX.equals(endpoint.getFormat())) {
                 axisOutMsgCtx.setDoingREST(true);
-
-            } else if (endpoint.isForceSOAP()) {
+                
+            } else if (SynapseConstants.FORMAT_SOAP11.equals(endpoint.getFormat())) {
+                axisOutMsgCtx.setDoingREST(false);
+                if (axisOutMsgCtx.getSoapAction() == null && axisOutMsgCtx.getWSAAction()
!= null) {
+                    axisOutMsgCtx.setSoapAction(axisOutMsgCtx.getWSAAction());
+                }
+                if(axisOutMsgCtx.isSOAP11() != true) {
+                    SOAPUtils.convertSoapVersion(axisOutMsgCtx, org.apache.axis2.namespace.Constants.URI_SOAP11_ENV);
+                }
+                
+            } else if (SynapseConstants.FORMAT_SOAP12.equals(endpoint.getFormat())) {
                 axisOutMsgCtx.setDoingREST(false);
                 if (axisOutMsgCtx.getSoapAction() == null && axisOutMsgCtx.getWSAAction()
!= null) {
                     axisOutMsgCtx.setSoapAction(axisOutMsgCtx.getWSAAction());
                 }
+                if(axisOutMsgCtx.isSOAP11() == true) {
+                    SOAPUtils.convertSoapVersion(axisOutMsgCtx, org.apache.axis2.namespace.Constants.URI_SOAP12_ENV);
+                }                
+                
             }
 
             if (endpoint.isUseMTOM()) {

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseCallbackReceiver.java
Tue Oct  2 02:38:37 2007
@@ -39,6 +39,7 @@
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.endpoints.Endpoint;
+import org.apache.synapse.mediators.eip.EIPUtils;
 
 import java.util.*;
 
@@ -143,9 +144,10 @@
      * @param synapseOutMsgCtx the corresponding (outgoing) Synapse MessageContext for the
above
      *                         Axis2 MC, that holds Synapse specific information such as
the error
      *                         handler stack and local properties etc.
+     * @throws AxisFault 
      */
     private void handleMessage(MessageContext response,
-                               org.apache.synapse.MessageContext synapseOutMsgCtx) {
+                               org.apache.synapse.MessageContext synapseOutMsgCtx) throws
AxisFault {
 
         Object o = response.getProperty(NhttpConstants.SENDING_FAULT);
         if (o != null && Boolean.TRUE.equals(o)) {
@@ -231,6 +233,16 @@
                 response.setProperty(
                         org.apache.axis2.Constants.Configuration.ENABLE_SWA,
                         org.apache.axis2.Constants.VALUE_TRUE);
+            }
+            
+            // compare original received message (axisOutMsgCtx) soap version with the response
+            // if they are different change to original version 
+            if(axisOutMsgCtx.isSOAP11() != response.isSOAP11()) {
+            	if(axisOutMsgCtx.isSOAP11()) {
+            		SOAPUtils.convertSoapVersion(response, org.apache.axis2.namespace.Constants.URI_SOAP11_ENV);
+            	} else {
+            		SOAPUtils.convertSoapVersion(response, org.apache.axis2.namespace.Constants.URI_SOAP12_ENV);
+            	}
             }
 
             if (axisOutMsgCtx.getMessageID() != null) {

Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java?rev=581173&r1=581172&r2=581173&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java
(original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/endpoints/utils/EndpointDefinition.java
Tue Oct  2 02:38:37 2007
@@ -51,6 +51,8 @@
     private boolean useMTOM = false;
     /** use SWA **/
     private boolean useSwa = false;
+    /** Endpoint message format. pox/soap11/soap12 */
+    private String format = null;
 
     /**
      * timeout duration for waiting for a response. if the user has set some timeout action
and
@@ -216,8 +218,16 @@
     public void setTimeoutAction(int timeoutAction) {
         this.timeoutAction = timeoutAction;
     }
+    
+    public String getFormat() {
+        return format;
+	}
 
-    /**
+	public void setFormat(String format) {
+		this.format = format;
+	}
+
+	/**
      * To check whether statistics should have collected or not
      *
      * @return Returns the int value that indicate statistics is enabled or not.



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message