geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r161120 - in geronimo/trunk/modules: axis-builder/src/java/org/apache/geronimo/axis/builder/ axis/src/java/org/apache/geronimo/axis/server/ webservices/src/java/org/apache/geronimo/webservices/
Date Tue, 12 Apr 2005 21:03:27 GMT
Author: djencks
Date: Tue Apr 12 14:03:26 2005
New Revision: 161120

URL: http://svn.apache.org/viewcvs?view=rev&rev=161120
Log:
Fixed bugs in request URI and URL wsdl access

Modified:
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
    geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
    geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java?view=diff&r1=161119&r2=161120
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/AxisServiceBuilder.java
Tue Apr 12 14:03:26 2005
@@ -16,6 +16,34 @@
  */
 package org.apache.geronimo.axis.builder;
 
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarFile;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.HandlerInfo;
+
 import org.apache.axis.constants.Style;
 import org.apache.axis.constants.Use;
 import org.apache.axis.description.JavaServiceDesc;
@@ -24,36 +52,30 @@
 import org.apache.axis.encoding.SerializerFactory;
 import org.apache.axis.encoding.TypeMapping;
 import org.apache.axis.encoding.TypeMappingRegistryImpl;
-import org.apache.axis.encoding.ser.*;
+import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
+import org.apache.axis.encoding.ser.ArraySerializerFactory;
+import org.apache.axis.encoding.ser.BaseDeserializerFactory;
+import org.apache.axis.encoding.ser.BaseSerializerFactory;
+import org.apache.axis.encoding.ser.BeanDeserializerFactory;
+import org.apache.axis.encoding.ser.BeanSerializerFactory;
 import org.apache.geronimo.axis.server.ReadOnlyServiceDesc;
 import org.apache.geronimo.axis.server.ServiceInfo;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.deployment.util.DeploymentUtil;
 import org.apache.geronimo.kernel.ClassLoading;
-import org.apache.geronimo.xbeans.j2ee.*;
+import org.apache.geronimo.xbeans.j2ee.JavaXmlTypeMappingType;
+import org.apache.geronimo.xbeans.j2ee.ParamValueType;
+import org.apache.geronimo.xbeans.j2ee.PortComponentHandlerType;
+import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType;
+import org.apache.geronimo.xbeans.j2ee.XsdQNameType;
 import org.apache.xmlbeans.SchemaType;
-import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlException;
-import org.w3.x2001.xmlSchema.SchemaDocument;
+import org.apache.xmlbeans.XmlObject;
 import org.w3.x2001.xmlSchema.ImportDocument;
 import org.w3.x2001.xmlSchema.IncludeDocument;
+import org.w3.x2001.xmlSchema.SchemaDocument;
 import org.w3c.dom.Element;
-
-import javax.wsdl.*;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.schema.Schema;
-import javax.xml.namespace.QName;
-import javax.xml.rpc.handler.HandlerInfo;
-import java.lang.String;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-import java.util.jar.JarFile;
+import org.w3c.dom.Node;
 
 /**
  * @version $Rev$ $Date$
@@ -61,6 +83,7 @@
 public class AxisServiceBuilder {
 
     public static final String XSD_NS = "http://www.w3.org/2001/XMLSchema";
+    public static final QName SCHEMA_QNAME = new QName(XSD_NS, "schema");
 
 
     private static void validateLightweightMapping(Definition definition) throws DeploymentException
{
@@ -395,6 +418,7 @@
                     }
                 }
                 Types types = definition.getTypes();
+                Map namespaceMap = definition.getNamespaces();
                 List schemaList = types.getExtensibilityElements();
                 for (Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();) {
                     Object o = iterator1.next();
@@ -408,6 +432,22 @@
                             schemaType.setElement(e2);
                         } catch (XmlException e1) {
                             throw new DeploymentException("Could not parse included schema",
e1);
+                        }
+                    } else if (o instanceof UnknownExtensibilityElement) {
+                        UnknownExtensibilityElement u = (UnknownExtensibilityElement) o;
+                        QName elementType = u.getElementType();
+                        if (SCHEMA_QNAME.equals(elementType)) {
+                            Element e = u.getElement();
+                            try {
+                                SchemaDocument schemaDocument = (SchemaDocument) SchemaInfoBuilder.parseWithNamespaces(e,
namespaceMap);
+                                SchemaDocument.Schema schema = schemaDocument.getSchema();
+                                rewriteSchema(schema, contextURI, key);
+                                Node node = schema.newDomNode();
+                                Element e2 = (Element) node.getFirstChild();
+                                u.setElement(e2);
+                            } catch (XmlException e1) {
+                                throw new DeploymentException("Could not parse included schema",
e1);
+                            }
                         }
                     }
                 }

Modified: geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java?view=diff&r1=161119&r2=161120
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
(original)
+++ geronimo/trunk/modules/axis-builder/src/java/org/apache/geronimo/axis/builder/SchemaInfoBuilder.java
Tue Apr 12 14:03:26 2005
@@ -237,21 +237,26 @@
 
     private void addSchemaElement(Element element, Map namespaceMap, List schemaList) throws
DeploymentException {
         try {
-            XmlObject xmlObject = SchemaConversionUtils.parse(element);
-            XmlCursor cursor = xmlObject.newCursor();
-            try {
-                cursor.toFirstContentToken();
-                for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();)
{
-                    Map.Entry entry = (Map.Entry) namespaces.next();
-                    cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
-                }
-            } finally {
-                cursor.dispose();
-            }
+            XmlObject xmlObject = parseWithNamespaces(element, namespaceMap);
             schemaList.add(xmlObject);
         } catch (XmlException e) {
             throw new DeploymentException("Could not parse schema element", e);
         }
+    }
+
+    static XmlObject parseWithNamespaces(Element element, Map namespaceMap) throws XmlException
{
+        XmlObject xmlObject = SchemaConversionUtils.parse(element);
+        XmlCursor cursor = xmlObject.newCursor();
+        try {
+            cursor.toFirstContentToken();
+            for (Iterator namespaces = namespaceMap.entrySet().iterator(); namespaces.hasNext();)
{
+                Map.Entry entry = (Map.Entry) namespaces.next();
+                cursor.insertNamespace((String) entry.getKey(), (String) entry.getValue());
+            }
+        } finally {
+            cursor.dispose();
+        }
+        return xmlObject;
     }
 
     /**

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java?view=diff&r1=161119&r2=161120
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/server/AxisWebServiceContainer.java
Tue Apr 12 14:03:26 2005
@@ -201,20 +201,23 @@
 
     public void getWsdl(Request request, Response response) throws Exception {
         URI realLocation = request.getURI();
-        String locationKey = request.getParameter("wsdl");
-        if (locationKey == null) {
-            locationKey = request.getParameter("WSDL");
+        String query = realLocation.getQuery();
+        if (query == null || !query.toLowerCase().startsWith("wsdl")) {
+            throw new IllegalStateException("request must contain a  wsdl or WSDL parameter:
" + request.getParameters());
         }
-        if ("".equals(locationKey)) {
+        String locationKey;
+        if (query.length() > 4) {
+            locationKey = query.substring(5);
+        } else {
             locationKey = wsdlLocation.toString();
-        } else if (locationKey == null) {
-            throw new IllegalStateException("request must contain a  wsdl or WSDL parameter:
" + request.getParameters());
         }
         Object wsdl = wsdlMap.get(locationKey);
         if (wsdl == null) {
             throw new IllegalStateException("No wsdl or schema known at location: " + locationKey);
         }
         if (wsdl instanceof String) {
+//            log.info("===========XSD==============" + locationKey);
+//            log.info(wsdl);
             response.getOutputStream().write(((String)wsdl).getBytes());
         } else {
             Definition definition = (Definition) wsdl;
@@ -244,6 +247,11 @@
                         }
                     }
                 }
+//                log.info("===========WSDL==============" + locationKey);
+//                OutputStream baos = new java.io.ByteArrayOutputStream();
+//                wsdlWriter.writeWSDL(definition, baos);
+//                log.info(baos.toString());
+
                 // Dump the WSDL dom to the output stream
                 OutputStream out = response.getOutputStream();
                 wsdlWriter.writeWSDL(definition, out);

Modified: geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java?view=diff&r1=161119&r2=161120
==============================================================================
--- geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java
(original)
+++ geronimo/trunk/modules/webservices/src/java/org/apache/geronimo/webservices/WebServiceContainerInvoker.java
Tue Apr 12 14:03:26 2005
@@ -106,8 +106,7 @@
 
         public java.net.URI getURI() {
             try {
-                String uriString = request.getRequestURI();
-                return new java.net.URI(uriString);
+                return new java.net.URI(request.getScheme(), null, request.getServerName(),
request.getServerPort(), request.getRequestURI(), request.getQueryString(), null);
             } catch (URISyntaxException e) {
                 throw new IllegalStateException(e.getMessage());
             }



Mime
View raw message