Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 36885 invoked from network); 2 Jul 2007 14:36:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Jul 2007 14:36:08 -0000 Received: (qmail 23203 invoked by uid 500); 2 Jul 2007 14:36:10 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 23095 invoked by uid 500); 2 Jul 2007 14:36:09 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 23084 invoked by uid 500); 2 Jul 2007 14:36:09 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 23081 invoked by uid 99); 2 Jul 2007 14:36:09 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 07:36:09 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Jul 2007 07:36:05 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 499FF1A981A; Mon, 2 Jul 2007 07:35:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r552506 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: description/AxisService2WSDL11.java description/AxisService2WSDL20.java util/WSDLSerializationUtil.java Date: Mon, 02 Jul 2007 14:35:45 -0000 To: axis2-cvs@ws.apache.org From: keithc@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070702143545.499FF1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: keithc Date: Mon Jul 2 07:35:44 2007 New Revision: 552506 URL: http://svn.apache.org/viewvc?view=rev&rev=552506 Log: Fixing AXIS2-2734. Disabling http binding and endpoint generation in WSDL when REST is disabled. Modified: 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/description/AxisService2WSDL11.java URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?view=diff&rev=552506&r1=552505&r2=552506 ============================================================================== --- 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 Mon Jul 2 07:35:44 2007 @@ -31,6 +31,7 @@ import org.apache.axis2.util.PolicyUtil; import org.apache.axis2.util.XMLUtils; import org.apache.axis2.util.WSDLSerializationUtil; +import org.apache.axis2.util.JavaUtils; import org.apache.axis2.wsdl.SOAPHeaderMessage; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; @@ -142,6 +143,14 @@ namespaceMap.put(prefix, axisService.getTargetNamespace()); tns = ele.declareNamespace(axisService.getTargetNamespace(), prefix); + boolean disableREST = false; + Parameter disableRESTParameter = + axisService.getParameter(org.apache.axis2.Constants.Configuration.DISABLE_REST); + if (disableRESTParameter != null && + JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { + disableREST = true; + } + // adding documentation element // <b>NEW!</b> This method accepts an ISBN // string and returns <b>Amazon.co.uk</b> Sales Rank for @@ -177,9 +186,11 @@ generatePortType(fac, ele); generateSOAP11Binding(fac, ele); generateSOAP12Binding(fac, ele); - generateHTTPBinding(fac, ele); + if (!disableREST) { + generateHTTPBinding(fac, ele); + } - generateService(fac, ele); + generateService(fac, ele, disableREST); addPoliciesToDefinitionElement(policiesInDefinitions.values() .iterator(), definition); @@ -406,7 +417,7 @@ /** * Generate the service */ - public void generateService(OMFactory fac, OMElement defintions) + public void generateService(OMFactory fac, OMElement defintions, boolean disableREST) throws Exception { OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl); defintions.addChild(service); @@ -416,7 +427,9 @@ addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService .getPolicyInclude(), service, fac); + if (!disableREST) { generateHTTPPorts(fac, service); + } } private void generateSOAP11Ports(OMFactory fac, OMElement 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?view=diff&rev=552506&r1=552505&r2=552506 ============================================================================== --- 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 Mon Jul 2 07:35:44 2007 @@ -27,7 +27,9 @@ import org.apache.axiom.om.OMText; import org.apache.axis2.util.XMLUtils; import org.apache.axis2.util.WSDLSerializationUtil; +import org.apache.axis2.util.JavaUtils; import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; import org.apache.axis2.wsdl.WSDLConstants; import org.apache.ws.commons.schema.XmlSchema; @@ -179,6 +181,14 @@ // Add the interface element descriptionElement.addChild(getInterfaceElement(wsdl, tns, wsdlx, omFactory, interfaceName)); + boolean disableREST = false; + Parameter disableRESTParameter = + axisService.getParameter(Constants.Configuration.DISABLE_REST); + if (disableRESTParameter != null && + JavaUtils.isTrueExplicitly(disableRESTParameter.getValue())) { + disableREST = true; + } + // Check whether the axisService has any endpoints. If they exists serialize them else // generate default endpoint elements. Set bindings = new HashSet(); @@ -197,7 +207,14 @@ // https then we have two endpoints populated so we should serialize them instead // of updating the endpoints. AxisEndpoint axisEndpoint = (AxisEndpoint) iterator.next(); - bindings.add(axisEndpoint.getBinding()); + AxisBinding axisBinding = axisEndpoint.getBinding(); + String type = axisBinding.getType(); + if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) { + if (disableREST) { + continue; + } + } + bindings.add(axisBinding); for (int i = 0; i < eprs.length; i++) { String epr = eprs[i]; OMElement endpointElement = axisEndpoint.toWSDL20(wsdl, tns, whttp, epr); @@ -243,12 +260,15 @@ descriptionElement.addChild( WSDLSerializationUtil.generateSOAP12Binding(omFactory, axisService, wsdl, wsoap, tns)); - descriptionElement.addChild( - WSDLSerializationUtil.generateHTTPBinding(omFactory, axisService, wsdl, whttp, - tns)); + if (!disableREST) { + descriptionElement.addChild( + WSDLSerializationUtil.generateHTTPBinding(omFactory, axisService, wsdl, + whttp, + tns)); + } descriptionElement .addChild(WSDLSerializationUtil.generateServiceElement(omFactory, wsdl, tns, - axisService)); + axisService, disableREST)); } return descriptionElement; 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?view=diff&rev=552506&r1=552505&r2=552506 ============================================================================== --- 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 Mon Jul 2 07:35:44 2007 @@ -272,7 +272,7 @@ * @throws AxisFault - Thrown in case an exception occurs */ public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl, OMNamespace tns, - AxisService axisService) + AxisService axisService, boolean disableREST) throws AxisFault { String[] eprs = axisService.getEPRs(); if (eprs == null) { @@ -315,17 +315,21 @@ soap12EndpointElement.addAttribute( omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr)); serviceElement.addChild(soap12EndpointElement); - OMElement httpEndpointElement = - omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl); - httpEndpointElement.addAttribute(omFactory.createOMAttribute( - WSDL2Constants.ATTRIBUTE_NAME, null, - name + WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME)); - httpEndpointElement.addAttribute(omFactory.createOMAttribute( - WSDL2Constants.BINDING_LOCAL_NAME, null, - tns.getPrefix() + ":" + axisService.getName() + Java2WSDLConstants.HTTP_BINDING)); - httpEndpointElement.addAttribute( - omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr)); - serviceElement.addChild(httpEndpointElement); + OMElement httpEndpointElement = null; + if (!disableREST) { + httpEndpointElement = + omFactory.createOMElement(WSDL2Constants.ENDPOINT_LOCAL_NAME, wsdl); + httpEndpointElement.addAttribute(omFactory.createOMAttribute( + WSDL2Constants.ATTRIBUTE_NAME, null, + name + WSDL2Constants.DEFAULT_HTTP_ENDPOINT_NAME)); + httpEndpointElement.addAttribute(omFactory.createOMAttribute( + WSDL2Constants.BINDING_LOCAL_NAME, null, + tns.getPrefix() + ":" + axisService.getName() + Java2WSDLConstants + .HTTP_BINDING)); + httpEndpointElement.addAttribute( + omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_ADDRESS, null, epr)); + serviceElement.addChild(httpEndpointElement); + } if (epr.startsWith("https://")) { OMElement soap11Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap11Documentation.setText("This endpoint exposes a SOAP 11 binding over a HTTPS"); @@ -333,9 +337,12 @@ OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTPS"); soap12EndpointElement.addChild(soap12Documentation); - OMElement httpDocumentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); - httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTPS"); - httpEndpointElement.addChild(httpDocumentation); + if (!disableREST) { + OMElement httpDocumentation = + omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); + httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTPS"); + 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"); @@ -343,9 +350,12 @@ OMElement soap12Documentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); soap12Documentation.setText("This endpoint exposes a SOAP 12 binding over a HTTP"); soap12EndpointElement.addChild(soap12Documentation); - OMElement httpDocumentation = omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); - httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTP"); - httpEndpointElement.addChild(httpDocumentation); + if (!disableREST) { + OMElement httpDocumentation = + omFactory.createOMElement(WSDL2Constants.DOCUMENTATION, wsdl); + httpDocumentation.setText("This endpoint exposes a HTTP binding over a HTTP"); + httpEndpointElement.addChild(httpDocumentation); + } } } return serviceElement; --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org