Author: deepal
Date: Mon Jan  9 01:29:10 2006
New Revision: 367252

URL: http://svn.apache.org/viewcvs?rev=367252&view=rev
Log:
implemented ?xsd support in both AxisServlet and SimpleHTTPServer , when you 
type ?xsd (same as ?wsdl) it will give you the corresponding schema for that 
service. 

Modified:
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
    
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=367252&r1=367251&r2=367252&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
 Mon Jan  9 01:29:10 2006
@@ -306,6 +306,11 @@
         operationsAliasesMap.put(action, axisOperation);
     }
 
+
+    public void printSchema(OutputStream out) throws AxisFault {
+        schema.write(out);
+    }
+
     public void printWSDL(OutputStream out, String serviceURL) throws 
AxisFault {
         if (getWSDLDefinition() != null) {
             printUsingWSDLDefinition(out, serviceURL);

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java?rev=367252&r1=367251&r2=367252&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/HTTPWorker.java
 Mon Jan  9 01:29:10 2006
@@ -152,6 +152,19 @@
                         return true;
                     }
                 }
+                if (uri.endsWith("?xsd")) {
+                    String serviceName = uri.substring(uri.lastIndexOf("/") + 
1, uri.length() - 4);
+                    HashMap services = 
configurationContext.getAxisConfiguration().getServices();
+                    AxisService service = (AxisService) 
services.get(serviceName);
+                    if (service != null) {
+                        response.addHeader(new Header("Content-Type", 
"text/xml"));
+                        service.printSchema(baos);
+                        byte[] buf = baos.toByteArray();
+                        response.setBody(new ByteArrayInputStream(buf));
+                        conn.writeResponse(response);
+                        return true;
+                    }
+                }
 
                 // It is GET handle the Get request
                 boolean processed = HTTPTransportUtils.processHTTPGetRequest(

Modified: 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: 
http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=367252&r1=367251&r2=367252&view=diff
==============================================================================
--- 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
 (original)
+++ 
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
 Mon Jan  9 01:29:10 2006
@@ -460,21 +460,21 @@
         String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1, 
filePart.length());
         HashMap services = configContext.getAxisConfiguration().getServices();
         String wsdl = req.getParameter("wsdl");
-
+        String xsd = req.getParameter("xsd");
         if ((services != null) && !services.isEmpty()) {
             Object serviceObj = services.get(serviceName);
-
             if (serviceObj != null) {
                 if (wsdl != null) {
                     res.setContentType("text/xml");
                     ((AxisService) serviceObj).printWSDL(out, filePart);
-
-//                    PrintWriter out_writer = new PrintWriter(out);
-
-//                    ((AxisService) serviceObj).printWSDL(out_writer, 
filePart);
                     out.flush();
                     out.close();
-
+                    return;
+                } else if (xsd != null) {
+                    res.setContentType("text/xml");
+                    ((AxisService) serviceObj).printSchema(out);
+                    out.flush();
+                    out.close();
                     return;
                 } else {
                     req.getSession().setAttribute(Constants.SINGLE_SERVICE, 
serviceObj);


Reply via email to