geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r681800 - in /geronimo/server/trunk/plugins: axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/ cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/
Date Fri, 01 Aug 2008 19:42:13 GMT
Author: gawor
Date: Fri Aug  1 12:42:11 2008
New Revision: 681800

URL: http://svn.apache.org/viewvc?rev=681800&view=rev
Log:
do not return wsdl for web services using http binding

Modified:
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
    geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
    geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?rev=681800&r1=681799&r2=681800&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
Fri Aug  1 12:42:11 2008
@@ -307,10 +307,12 @@
         }
     }
     
-    protected void processGETRequest(Request request, Response response, AxisService service,
MessageContext msgContext) throws Exception{        
-        if (request.getURI().getQuery() != null &&
-            (request.getURI().getQuery().startsWith("wsdl") ||
-             request.getURI().getQuery().startsWith("xsd"))) {
+    protected void processGETRequest(Request request, Response response, AxisService service,
MessageContext msgContext) throws Exception{
+        if (AxisServiceGenerator.isHTTP(service)) {
+            processURLRequest(request, response, service, msgContext);
+        } else if (request.getURI().getQuery() != null &&
+                   (request.getURI().getQuery().startsWith("wsdl") ||
+                    request.getURI().getQuery().startsWith("xsd"))) {
             // wsdl or xsd request
             
             if (portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals(""))
{ 

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?rev=681800&r1=681799&r2=681800&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
Fri Aug  1 12:42:11 2008
@@ -314,5 +314,10 @@
         return javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING.equals(desc.getBindingType())
||
                javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(desc.getBindingType());
     }
+    
+    public static boolean isHTTP(AxisService service) {
+        EndpointDescription desc = AxisServiceGenerator.getEndpointDescription(service);
+        return javax.xml.ws.http.HTTPBinding.HTTP_BINDING.equals(desc.getBindingType());
+    }
          
 }

Modified: geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java?rev=681800&r1=681799&r2=681800&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java
(original)
+++ geronimo/server/trunk/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/WSDLQueryHandler.java
Fri Aug  1 12:42:11 2008
@@ -19,6 +19,7 @@
 
 package org.apache.geronimo.axis2;
 
+import java.io.FileNotFoundException;
 import java.io.OutputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
@@ -76,19 +77,28 @@
     
     public void writeResponse(String baseUri, String wsdlUri, OutputStream os) throws Exception
{
 
-        int idx = baseUri.toLowerCase().indexOf("?wsdl");
         String base = null;
         String wsdl = "";
         String xsd = null;
+        
+        int idx = baseUri.toLowerCase().indexOf("?wsdl");
         if (idx != -1) {
-            base = baseUri.substring(0, baseUri.toLowerCase().indexOf("?wsdl"));
-            wsdl = baseUri.substring(baseUri.toLowerCase().indexOf("?wsdl") + 5);
+            base = baseUri.substring(0, idx);
+            wsdl = baseUri.substring(idx + 5);
             if (wsdl.length() > 0) {
                 wsdl = wsdl.substring(1);
             }
         } else {
-            base = baseUri.substring(0, baseUri.toLowerCase().indexOf("?xsd="));
-            xsd = baseUri.substring(baseUri.toLowerCase().indexOf("?xsd=") + 5);
+            idx = baseUri.toLowerCase().indexOf("?xsd");
+            if (idx != -1) {
+                base = baseUri.substring(0, idx);
+                xsd = baseUri.substring(idx + 4);
+                if (xsd.length() > 0) {
+                    xsd = xsd.substring(1);
+                }
+            } else {
+                throw new Exception("Invalid request: " + baseUri);
+            }
         }
 
         if (!mp.containsKey(wsdl)) {
@@ -107,12 +117,21 @@
         if (xsd == null) {
             Definition def = mp.get(wsdl);
 
+            if (def == null) {
+                throw new FileNotFoundException("WSDL not found: " + wsdl);
+            }
+            
             WSDLFactory factory = WSDLFactory.newInstance();
             WSDLWriter writer = factory.newWSDLWriter();
 
             rootElement = writer.getDocument(def).getDocumentElement();
         } else {
             SchemaReference si = smp.get(xsd);
+            
+            if (si == null) {
+                throw new FileNotFoundException("Schema not found: " + xsd);
+            }
+            
             rootElement = si.getReferencedSchema().getElement();
         }
 

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java?rev=681800&r1=681799&r2=681800&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFEndpoint.java
Fri Aug  1 12:42:11 2008
@@ -107,6 +107,10 @@
               SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(implInfo.getBindingType());
     }
     
+    public boolean isHTTP() {
+        return HTTPBinding.HTTP_BINDING.equals(implInfo.getBindingType());
+     }
+    
     public ServerImpl getServer() {
         return (ServerImpl) server;
     }

Modified: geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java?rev=681800&r1=681799&r2=681800&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
(original)
+++ geronimo/server/trunk/plugins/cxf/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/CXFWebServiceContainer.java
Fri Aug  1 12:42:11 2008
@@ -85,8 +85,17 @@
     }
     
     protected void processGET(Request request, Response response) throws Exception {
-        if (request.getParameter("xsd") != null || request.getParameter("XSD") != null) {
-            getWsdl(request, response);
+        if (endpoint.isHTTP()) {
+            processPOST(request, response);
+        } else if (request.getParameter("wsdl") != null || request.getParameter("WSDL") !=
null ||
+                   request.getParameter("xsd") != null || request.getParameter("XSD") !=
null) {
+            GeronimoQueryHandler queryHandler = new GeronimoQueryHandler(this.bus);
+            URI requestURI = request.getURI();
+            EndpointInfo ei = this.destination.getEndpointInfo();
+            OutputStream out = response.getOutputStream();
+            String baseUri = requestURI.toString();
+            response.setContentType("text/xml");
+            queryHandler.writeResponse(baseUri, null, ei, out);
         } else if (endpoint.isSOAP11()) {
             EndpointInfo ei = this.destination.getEndpointInfo();
             response.setContentType("text/html");
@@ -111,13 +120,7 @@
     }
    
     public void getWsdl(Request request, Response response) throws Exception {
-        GeronimoQueryHandler queryHandler = new GeronimoQueryHandler(this.bus);
-        URI requestURI = request.getURI();
-        EndpointInfo ei = this.destination.getEndpointInfo();
-        OutputStream out = response.getOutputStream();
-        String baseUri = requestURI.toString();
-        response.setContentType("text/xml");
-        queryHandler.writeResponse(baseUri, null, ei, out);
+        invoke(request, response);
     }    
         
     public void destroy() {



Mime
View raw message