You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by de...@apache.org on 2008/07/11 10:42:50 UTC

svn commit: r675865 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: Constants.java description/AxisService2WSDL11.java description/AxisService2WSDL20.java util/WSDLSerializationUtil.java

Author: deepal
Date: Fri Jul 11 01:42:49 2008
New Revision: 675865

URL: http://svn.apache.org/viewvc?rev=675865&view=rev
Log:
added a way to control the binding generation

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java?rev=675865&r1=675864&r2=675865&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/Constants.java Fri Jul 11 01:42:49 2008
@@ -337,6 +337,7 @@
                 "drillDownToRootCauseForFaultReason";
 
         public static final String DISABLE_REST   = "disableREST";
+        public static final String DISABLE_SOAP11   = "disableSOAP11";
         public static final String DISABLE_SOAP12 = "disableSOAP12";
 
         // this will contain the keys of all the properties that will be in the message context

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=675865&r1=675864&r2=675865&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Fri Jul 11 01:42:49 2008
@@ -181,7 +181,15 @@
 			disableREST = true;
 		}
 
-		// axis2.xml indicated no SOAP 1.2 binding?
+        boolean disableSOAP11 = false;
+		Parameter disableSOAP11Parameter = axisService
+				.getParameter(org.apache.axis2.Constants.Configuration.DISABLE_SOAP11);
+		if (disableSOAP11Parameter != null
+				&& JavaUtils.isTrueExplicitly(disableSOAP11Parameter.getValue())) {
+			disableSOAP11 = true;
+		}
+
+        // axis2.xml indicated no SOAP 1.2 binding?
 		boolean disableSOAP12 = false;
 		Parameter disableSOAP12Parameter = axisService
 				.getParameter(org.apache.axis2.Constants.Configuration.DISABLE_SOAP12);
@@ -234,7 +242,7 @@
 		// generateHTTPBinding(fac, ele);
 		// }
 
-		generateService(fac, ele, disableREST, disableSOAP12);
+		generateService(fac, ele, disableREST, disableSOAP12 , disableSOAP11);
 		addPoliciesToDefinitionElement(policiesInDefinitions.values()
 				.iterator(), definition);
 
@@ -475,17 +483,22 @@
 	 *             if there's a problem
 	 */
 	public void generateService(OMFactory fac, OMElement defintions,
-			boolean disableREST, boolean disableSOAP12) throws Exception {
+			boolean disableREST, boolean disableSOAP12 , boolean  disableSOAP11) throws Exception {
 		OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl);
 		defintions.addChild(service);
 		service.addAttribute(ATTRIBUTE_NAME, serviceName, null);
-		generateSoap11Port(fac, defintions, service);
-		if (!disableSOAP12) {
+
+        if (!disableSOAP11) {
+			generateSoap11Port(fac, defintions, service);
+		}
+
+        if (!disableSOAP12) {
 			// generateSOAP12Ports(fac, service);
 			generateSoap12Port(fac, defintions, service);
 		}
 
-		addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService
+
+        addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService
 				.getPolicyInclude(), service);
 		// addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService.
 		// getPolicyInclude(), service);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?rev=675865&r1=675864&r2=675865&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Fri Jul 11 01:42:49 2008
@@ -26,6 +26,7 @@
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
@@ -231,6 +232,14 @@
             disableREST = true;
         }
 
+        boolean disableSOAP11 = false;
+        Parameter disableSOAP11Parameter = axisService
+                .getParameter(org.apache.axis2.Constants.Configuration.DISABLE_SOAP11);
+        if (disableSOAP11Parameter != null
+                && JavaUtils.isTrueExplicitly(disableSOAP11Parameter.getValue())) {
+            disableSOAP11 = true;
+        }
+
         // axis2.xml indicated no SOAP 1.2 binding?
         boolean disableSOAP12 = false;
         Parameter disableSOAP12Parameter =
@@ -280,6 +289,14 @@
                     }
                 }
 
+                if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(propertySOAPVersion)) {
+                    if (disableSOAP11) {
+                        continue;
+                    }
+                }
+
+
+
                 bindings.add(axisBinding);
                 OMElement endpointElement = axisEndpoint.toWSDL20(wsdl, tns, whttp);
                 boolean endpointAlreadyAdded = false;
@@ -337,9 +354,14 @@
                     WSDLSerializationUtil.generateSOAP11Binding(omFactory, axisService, wsdl, wsoap,
                                                                 tns, serviceName));
             if (!disableSOAP12) {
-            descriptionElement.addChild(
-                    WSDLSerializationUtil.generateSOAP12Binding(omFactory, axisService, wsdl, wsoap,
-                                                                tns, serviceName));
+                descriptionElement.addChild(
+                        WSDLSerializationUtil.generateSOAP12Binding(omFactory, axisService, wsdl, wsoap,
+                                tns, serviceName));
+            }
+            if (!disableSOAP11) {
+                descriptionElement.addChild(
+                        WSDLSerializationUtil.generateSOAP11Binding(omFactory, axisService, wsdl, wsoap,
+                                tns, serviceName));
             }
             if (!disableREST) {
                 descriptionElement.addChild(
@@ -350,7 +372,7 @@
             descriptionElement
                     .addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl, tns,
                                                                            axisService, disableREST,
-                                                                           disableSOAP12, eprs,
+                                                                           disableSOAP12,disableSOAP11, eprs,
                                                                           serviceName));
         }
         

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?rev=675865&r1=675864&r2=675865&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java Fri Jul 11 01:42:49 2008
@@ -303,10 +303,10 @@
      */
     public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl,
                                                    OMNamespace tns, AxisService axisService,
-                                                   boolean disableREST, boolean disableSOAP12,
+                                                   boolean disableREST, boolean disableSOAP12,  boolean disableSOAP11,
                                                    String serviceName)
             throws AxisFault {
-        return generateServiceElement(omFactory, wsdl, tns, axisService, disableREST, disableSOAP12,
+        return generateServiceElement(omFactory, wsdl, tns, axisService, disableREST, disableSOAP12,disableSOAP11,
                                       null, serviceName);
     }
     
@@ -323,7 +323,7 @@
      */
     public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl,
                                                    OMNamespace tns, AxisService axisService,
-                                                   boolean disableREST, boolean disableSOAP12,
+                                                   boolean disableREST, boolean disableSOAP12, boolean disableSOAP11,
                                                    String[] eprs, String serviceName)
             throws AxisFault {
         if(eprs == null){
@@ -345,20 +345,23 @@
             if (epr.startsWith("https://")) {
                 name = WSDL2Constants.DEFAULT_HTTPS_PREFIX;
             }
-            
+
             OMElement soap11EndpointElement =
-                    omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
-            soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
+                    null;
+            if (!disableSOAP11) {
+                soap11EndpointElement = omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl);
+                soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
                     WSDL2Constants.ATTRIBUTE_NAME, null,
-                    name + WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME));
-            soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
+                        name + WSDL2Constants.DEFAULT_SOAP11_ENDPOINT_NAME));
+                soap11EndpointElement.addAttribute(omFactory.createOMAttribute(
                     WSDL2Constants.BINDING_LOCAL_NAME, null,
-                    tns.getPrefix() + ":" + serviceName +
-                            Java2WSDLConstants.BINDING_NAME_SUFFIX));
-            soap11EndpointElement.addAttribute(
+                        tns.getPrefix() + ":" + serviceName +
+                                Java2WSDLConstants.BINDING_NAME_SUFFIX));
+                soap11EndpointElement.addAttribute(
                     omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr));
-            serviceElement.addChild(soap11EndpointElement);
-            
+                serviceElement.addChild(soap11EndpointElement);
+            }
+
             OMElement soap12EndpointElement = null;
             if (!disableSOAP12) {
                 soap12EndpointElement =
@@ -392,9 +395,11 @@
             }
             
             if (epr.startsWith("https://")) {
-                OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
-                soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTPS");
-                soap11EndpointElement.addChild(soap11Documentation);
+                if (!disableSOAP11) {
+                    OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+                    soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTPS");
+                    soap11EndpointElement.addChild(soap11Documentation);
+                }
                 if (!disableSOAP12) {
                     OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
                     soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTPS");
@@ -407,9 +412,11 @@
                     httpEndpointElement.addChild(httpDocumentation);
                 }
             } else if (epr.startsWith("http://")) {
-                OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
-                soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTP");
-                soap11EndpointElement.addChild(soap11Documentation);
+                if (!disableSOAP11) {
+                    OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
+                    soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTP");
+                    soap11EndpointElement.addChild(soap11Documentation);
+                }
                 if (!disableSOAP12) {
                     OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl);
                     soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTP");