geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r201795 - in /geronimo/trunk/modules: axis-builder/ axis-builder/src/java/org/apache/geronimo/axis/builder/ axis-builder/src/schema/ axis/src/java/org/apache/geronimo/axis/server/
Date Sun, 26 Jun 2005 09:58:30 GMT
Author: djencks
Date: Sat Jun 25 15:19:42 2005
New Revision: 201795

URL: http://svn.apache.org/viewcvs?rev=201795&view=rev
Log:
use token replacement instead of wsdl4j to update location in wsdls.  More prone to breakage
but does not change the namespace prefixes which keeps certain other products happier.

Added:
    geronimo/trunk/modules/axis-builder/src/schema/wsdl.xsd
    geronimo/trunk/modules/axis-builder/src/schema/xmlconfig.xml
Modified:
    geronimo/trunk/modules/axis-builder/maven.xml
    geronimo/trunk/modules/axis-builder/project.xml
    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

Modified: geronimo/trunk/modules/axis-builder/maven.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/maven.xml?rev=201795&r1=201794&r2=201795&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/maven.xml (original)
+++ geronimo/trunk/modules/axis-builder/maven.xml Sat Jun 25 15:19:42 2005
@@ -26,13 +26,13 @@
     xmlns:xmlbeans="geronimo:xmlbeans"
     >
 
-<!--    <preGoal name="java:compile">-->
-<!--        <xmlbeans:schema2java-->
-<!--            sourcedir="${basedir}/src"-->
-<!--            sourceschema="schema/XMLSchema.xsd"-->
-<!--            xmlconfigs="${basedir}/src/schema/xmlconfig.xml"-->
-<!--            targetdir="${basedir}/target/xmlbeans"-->
-<!--            cataloglocation="${basedir}/../j2ee-schema/src/catalog/resolver-catalog.xml"/>-->
-<!--    </preGoal>-->
+    <preGoal name="java:compile">
+        <xmlbeans:schema2java
+            sourcedir="${basedir}/src"
+            sourceschema="schema/wsdl.xsd"
+            xmlconfigs="${basedir}/src/schema/xmlconfig.xml"
+            targetdir="${basedir}/target/xmlbeans"
+            cataloglocation="${basedir}/../j2ee-schema/src/catalog/resolver-catalog.xml"/>
+    </preGoal>
 
 </project>

Modified: geronimo/trunk/modules/axis-builder/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/project.xml?rev=201795&r1=201794&r2=201795&view=diff
==============================================================================
--- geronimo/trunk/modules/axis-builder/project.xml (original)
+++ geronimo/trunk/modules/axis-builder/project.xml Sat Jun 25 15:19:42 2005
@@ -43,6 +43,14 @@
     <dependencies>
 
         <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-xmlbeans-plugin</artifactId>
+            <version>${pom.currentVersion}</version>
+            <type>plugin</type>
+        </dependency>
+
+        <!-- what is this for?? -->
+        <dependency>
             <groupId>maven-plugins</groupId>
             <artifactId>maven-axis-plugin</artifactId>
             <version>0.5</version>

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?rev=201795&r1=201794&r2=201795&view=diff
==============================================================================
--- 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
Sat Jun 25 15:19:42 2005
@@ -34,11 +34,7 @@
 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.UnknownExtensibilityElement;
-import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.extensions.soap.SOAPAddress;
 import javax.wsdl.extensions.soap.SOAPBinding;
 import javax.wsdl.extensions.soap.SOAPBody;
@@ -51,19 +47,23 @@
 import org.apache.axis.encoding.TypeMapping;
 import org.apache.axis.encoding.TypeMappingRegistryImpl;
 import org.apache.geronimo.axis.client.TypeInfo;
+import org.apache.geronimo.axis.server.AxisWebServiceContainer;
 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.xbeans.j2ee.JavaXmlTypeMappingType;
 import org.apache.geronimo.xbeans.j2ee.ServiceEndpointMethodMappingType;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
+import org.apache.geronimo.xbeans.wsdl.DefinitionsDocument;
+import org.apache.geronimo.xbeans.wsdl.TDefinitions;
+import org.apache.geronimo.xbeans.wsdl.TImport;
+import org.apache.geronimo.xbeans.wsdl.TPort;
+import org.apache.geronimo.xbeans.wsdl.TService;
+import org.apache.geronimo.xbeans.wsdl.TTypes;
+import org.apache.xmlbeans.XmlCursor;
 import org.w3.x2001.xmlSchema.ImportDocument;
 import org.w3.x2001.xmlSchema.IncludeDocument;
 import org.w3.x2001.xmlSchema.SchemaDocument;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 
 /**
  * @version $Rev$ $Date$
@@ -71,6 +71,10 @@
 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 final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
+    private static final QName ADDRESS_QNAME = new QName(SOAP_NS, "address");
+    private static final QName LOCATION_QNAME = new QName("", "location");
+    private static final String LOCATION_REPLACEMENT_TOKEN = AxisWebServiceContainer.LOCATION_REPLACEMENT_TOKEN;
 
 
     private static void validateLightweightMapping(Definition definition) throws DeploymentException
{
@@ -234,57 +238,102 @@
                 rewriteSchema(schema, contextURI, key);
                 String schemaString = schemaDocument.toString();
                 wsdlMap.put(key.toString(), schemaString);
-            } else if (value instanceof Definition) {
-                Definition definition = (Definition) value;
-                Map imports = definition.getImports();
-                for (Iterator iterator2 = imports.values().iterator(); iterator2.hasNext();)
{
-                    List importList = (List) iterator2.next();
-                    for (Iterator iterator3 = importList.iterator(); iterator3.hasNext();)
{
-                        Import anImport = (Import) iterator3.next();
-                        String importLocation = anImport.getLocationURI();
-                        if (!importLocation.startsWith("http://")) {
-                            URI updated = buildQueryURI(contextURI, key, importLocation);
-                            anImport.setLocationURI(updated.toString());
-                        }
+//            } else if (value instanceof Definition) {
+//                Definition definition = (Definition) value;
+//                Map imports = definition.getImports();
+//                for (Iterator iterator2 = imports.values().iterator(); iterator2.hasNext();)
{
+//                    List importList = (List) iterator2.next();
+//                    for (Iterator iterator3 = importList.iterator(); iterator3.hasNext();)
{
+//                        Import anImport = (Import) iterator3.next();
+//                        String importLocation = anImport.getLocationURI();
+//                        if (!importLocation.startsWith("http://")) {
+//                            URI updated = buildQueryURI(contextURI, key, importLocation);
+//                            anImport.setLocationURI(updated.toString());
+//                        }
+//                    }
+//                }
+//                Types types = definition.getTypes();
+//                Map namespaceMap = definition.getNamespaces();
+//                if (null != types) {
+//                    List schemaList = types.getExtensibilityElements();
+//                    for (Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();)
{
+//                        Object o = iterator1.next();
+//                        if (o instanceof Schema) {
+//                            Schema schemaType = (Schema) o;
+//                            Element e = schemaType.getElement();
+//                            try {
+//                                SchemaDocument.Schema schema = (SchemaDocument.Schema)
XmlObject.Factory.parse(e);
+//                                rewriteSchema(schema, contextURI, key);
+//                                Element e2 = (Element) schema.newDomNode();
+//                                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);
+//                                }
+//                            }
+//                        }
+//                    }
+//                }
+//                wsdlMap.put(key.toString(), definition);
+            } else if (value instanceof DefinitionsDocument) {
+                DefinitionsDocument doc = (DefinitionsDocument) value;
+                TDefinitions definitions = doc.getDefinitions();
+                TImport[] imports = definitions.getImportArray();
+                for (int i = 0; i < imports.length; i++) {
+                    TImport anImport = imports[i];
+                    String importLocation = anImport.getLocation().trim();
+                    if (!importLocation.startsWith("http://")) {
+                        URI updated = buildQueryURI(contextURI, key, importLocation);
+                        anImport.setLocation(updated.toString());
                     }
                 }
-                Types types = definition.getTypes();
-                Map namespaceMap = definition.getNamespaces();
-                if (null != types) {
-                    List schemaList = types.getExtensibilityElements();
-                    for (Iterator iterator1 = schemaList.iterator(); iterator1.hasNext();)
{
-                        Object o = iterator1.next();
-                        if (o instanceof Schema) {
-                            Schema schemaType = (Schema) o;
-                            Element e = schemaType.getElement();
-                            try {
-                                SchemaDocument.Schema schema = (SchemaDocument.Schema) XmlObject.Factory.parse(e);
-                                rewriteSchema(schema, contextURI, key);
-                                Element e2 = (Element) schema.newDomNode();
-                                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);
-                                }
+                TTypes[] types = definitions.getTypesArray();
+                for (int i = 0; i < types.length; i++) {
+                    TTypes type = types[i];
+                    XmlCursor typeCursor = type.newCursor();
+                    try {
+                        typeCursor.toChild(SCHEMA_QNAME);
+                        do {
+                            SchemaDocument.Schema schema = (SchemaDocument.Schema) typeCursor.getObject();
+                            rewriteSchema(schema, contextURI, key);
+                         } while (typeCursor.toNextSibling(SCHEMA_QNAME));
+                    } finally {
+                        typeCursor.dispose();
+                    }
+                }
+                //prepare for location substitution
+                TService[] services = definitions.getServiceArray();
+                for (int i = 0; i < services.length; i++) {
+                    TService service = services[i];
+                    TPort[] ports = service.getPortArray();
+                    for (int j = 0; j < ports.length; j++) {
+                        TPort port = ports[j];
+                        XmlCursor portCursor = port.newCursor();
+                        try {
+                            if (portCursor.toChild(ADDRESS_QNAME)) {
+                                //TODO rewrite the path from the actual deployed location,
and just replace the schema/host/port
+                                portCursor.setAttributeText(LOCATION_QNAME, LOCATION_REPLACEMENT_TOKEN);
                             }
+                        } finally {
+                            portCursor.dispose();
                         }
                     }
                 }
-                wsdlMap.put(key.toString(), definition);
+                wsdlMap.put(key.toString(), doc.toString());
             } else {
                 throw new DeploymentException("Unexpected element in wsdlMap at location:
" + key + ", value: " + value);
             }

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?rev=201795&r1=201794&r2=201795&view=diff
==============================================================================
--- 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
Sat Jun 25 15:19:42 2005
@@ -50,6 +50,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.schema.SchemaConversionUtils;
+import org.apache.geronimo.xbeans.wsdl.DefinitionsDocument;
 import org.apache.xmlbeans.SchemaField;
 import org.apache.xmlbeans.SchemaGlobalElement;
 import org.apache.xmlbeans.SchemaParticle;
@@ -596,7 +597,8 @@
             try {
                 ZipEntry entry = moduleFile.getEntry(wsdlURI.toString());
                 wsdlInputStream = moduleFile.getInputStream(entry);
-                Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new InputSource(wsdlInputStream));
+//                Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new InputSource(wsdlInputStream));
+                DefinitionsDocument definition = DefinitionsDocument.Factory.parse(wsdlInputStream);
                 wsdlMap.put(wsdlURI, definition);
                 wsdlInputStream.close();
                 wsdlInputStream = moduleFile.getInputStream(entry);
@@ -618,10 +620,13 @@
                 ZipEntry entry = moduleFile.getEntry(latestImportURI.toString());
                 importInputStream = moduleFile.getInputStream(entry);
                 try {
-                    Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new InputSource(importInputStream));
+//                    Definition definition = wsdlReader.readWSDL(wsdlURI.toString(), new
InputSource(importInputStream));
+                    DefinitionsDocument definition = DefinitionsDocument.Factory.parse(importInputStream);
+                    wsdlMap.put(wsdlURI, definition);
+                    importInputStream.close();
                     wsdlMap.put(latestImportURI, definition);
                     importInputStream.close();
-                } catch (WSDLException e) {
+                } catch (XmlException e) {
                     //probably was a schema rather than wsdl.  If there are real problems
they will show up later.
                 }
                 importInputStream = moduleFile.getInputStream(entry);

Added: geronimo/trunk/modules/axis-builder/src/schema/wsdl.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/schema/wsdl.xsd?rev=201795&view=auto
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/schema/wsdl.xsd (added)
+++ geronimo/trunk/modules/axis-builder/src/schema/wsdl.xsd Sat Jun 25 15:19:42 2005
@@ -0,0 +1,311 @@
+<?xml version="1.0" encoding="UTF-8" ?> 
+<!-- 
+ 
+Copyright 2001-2003 International Business Machines Corporation, Microsoft Corporation. All
rights reserved.
+
+The presentation, distribution or other dissemination of the
+information contained herein by Microsoft is not a license,
+either expressly or impliedly, to any intellectual property owned or
+controlled by Microsoft.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and to the maximum extent permitted by applicable law,
+Microsoft provides the document AS IS AND WITH ALL FAULTS, and hereby
+disclaims all other warranties and conditions, either express, implied
+or statutory, including, but not limited to, any (if any) implied
+warranties, duties or conditions of merchantability, of fitness for a
+particular purpose, of accuracy or completeness of responses, of
+results, of workmanlike effort, of lack of viruses, and of lack of
+negligence, all with regard to the document. ALSO, THERE IS NO
+WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, QUIET POSSESSION,
+CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT WITH REGARD TO THE
+DOCUMENT.
+
+IN NO EVENT WILL MICROSOFT BE LIABLE TO ANY OTHER PARTY FOR THE COST
+OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS OF USE,
+LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, INDIRECT, OR
+SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, OR OTHERWISE,
+ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT RELATING TO THIS
+DOCUMENT, WHETHER OR NOT SUCH PARTY HAD ADVANCE NOTICE OF THE
+POSSIBILITY OF SUCH DAMAGES.  
+
+--> 
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+           targetNamespace="http://schemas.xmlsoap.org/wsdl/"
+           elementFormDefault="qualified" >
+   
+  <xs:complexType mixed="true" name="tDocumentation" >
+    <xs:sequence>
+      <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="tDocumented" >
+    <xs:annotation>
+      <xs:documentation>
+      This type is extended by  component types to allow them to be documented
+      </xs:documentation>
+    </xs:annotation>
+    <xs:sequence>
+      <xs:element name="documentation" type="wsdl:tDocumentation" minOccurs="0" />
+    </xs:sequence>
+  </xs:complexType>
+	 
+  <xs:complexType name="tExtensibleAttributesDocumented" abstract="true" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tDocumented" >
+        <xs:annotation>
+          <xs:documentation>
+          This type is extended by component types to allow attributes from other namespaces
to be added.
+          </xs:documentation>
+        </xs:annotation>
+        <xs:anyAttribute namespace="##other" processContents="lax" />    
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="tExtensibleDocumented" abstract="true" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tDocumented" >
+        <xs:annotation>
+          <xs:documentation>
+          This type is extended by component types to allow elements from other namespaces
to be added.
+          </xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+          <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"
/>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:element name="definitions" type="wsdl:tDefinitions" >
+    <xs:key name="message" >
+      <xs:selector xpath="wsdl:message" />
+      <xs:field xpath="@name" />
+    </xs:key>
+    <xs:key name="portType" >
+      <xs:selector xpath="wsdl:portType" />
+      <xs:field xpath="@name" />
+    </xs:key>
+    <xs:key name="binding" >
+      <xs:selector xpath="wsdl:binding" />
+      <xs:field xpath="@name" />
+    </xs:key>
+    <xs:key name="service" >
+      <xs:selector xpath="wsdl:service" />
+      <xs:field xpath="@name" />
+    </xs:key>
+    <xs:key name="import" >
+      <xs:selector xpath="wsdl:import" />
+      <xs:field xpath="@namespace" />
+    </xs:key>
+  </xs:element>
+
+  <xs:group name="anyTopLevelOptionalElement" >
+    <xs:annotation>
+      <xs:documentation>
+      Any top level optional element allowed to appear more then once - any child of definitions
element except wsdl:types. Any extensibility element is allowed in any place.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:choice>
+      <xs:element name="import" type="wsdl:tImport" />
+      <xs:element name="types" type="wsdl:tTypes" />                     
+      <xs:element name="message"  type="wsdl:tMessage" >
+        <xs:unique name="part" >
+          <xs:selector xpath="wsdl:part" />
+          <xs:field xpath="@name" />
+        </xs:unique>
+      </xs:element>
+      <xs:element name="portType" type="wsdl:tPortType" />
+      <xs:element name="binding"  type="wsdl:tBinding" />
+      <xs:element name="service"  type="wsdl:tService" >
+        <xs:unique name="port" >
+          <xs:selector xpath="wsdl:port" />
+          <xs:field xpath="@name" />
+        </xs:unique>
+	  </xs:element>
+    </xs:choice>
+  </xs:group>
+
+  <xs:complexType name="tDefinitions" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:sequence>
+          <xs:group ref="wsdl:anyTopLevelOptionalElement"  minOccurs="0"   maxOccurs="unbounded"
/>
+        </xs:sequence>
+        <xs:attribute name="targetNamespace" type="xs:anyURI" use="optional" />
+        <xs:attribute name="name" type="xs:NCName" use="optional" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+   
+  <xs:complexType name="tImport" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleAttributesDocumented" >
+        <xs:attribute name="namespace" type="xs:anyURI" use="required" />
+        <xs:attribute name="location" type="xs:anyURI" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+   
+  <xs:complexType name="tTypes" >
+    <xs:complexContent>   
+      <xs:extension base="wsdl:tExtensibleDocumented" />
+    </xs:complexContent>   
+  </xs:complexType>
+     
+  <xs:complexType name="tMessage" >
+    <xs:complexContent>   
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:sequence>
+          <xs:element name="part" type="wsdl:tPart" minOccurs="0" maxOccurs="unbounded"
/>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+      </xs:extension>
+    </xs:complexContent>   
+  </xs:complexType>
+
+  <xs:complexType name="tPart" >
+    <xs:complexContent>   
+      <xs:extension base="wsdl:tExtensibleAttributesDocumented" >
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+        <xs:attribute name="element" type="xs:QName" use="optional" />
+        <xs:attribute name="type" type="xs:QName" use="optional" />    
+      </xs:extension>
+    </xs:complexContent>   
+  </xs:complexType>
+
+  <xs:complexType name="tPortType" >
+    <xs:complexContent>   
+      <xs:extension base="wsdl:tExtensibleAttributesDocumented" >
+        <xs:sequence>
+          <xs:element name="operation" type="wsdl:tOperation" minOccurs="0" maxOccurs="unbounded"
/>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+      </xs:extension>
+    </xs:complexContent>   
+  </xs:complexType>
+   
+  <xs:complexType name="tOperation" >
+    <xs:complexContent>   
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+	    <xs:sequence>
+          <xs:choice>
+            <xs:group ref="wsdl:request-response-or-one-way-operation" />
+            <xs:group ref="wsdl:solicit-response-or-notification-operation" />
+          </xs:choice>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+        <xs:attribute name="parameterOrder" type="xs:NMTOKENS" use="optional" />
+      </xs:extension>
+    </xs:complexContent>   
+  </xs:complexType>
+    
+  <xs:group name="request-response-or-one-way-operation" >
+    <xs:sequence>
+      <xs:element name="input" type="wsdl:tParam" />
+	  <xs:sequence minOccurs='0' >
+	    <xs:element name="output" type="wsdl:tParam" />
+		<xs:element name="fault" type="wsdl:tFault" minOccurs="0" maxOccurs="unbounded" />
+      </xs:sequence>
+    </xs:sequence>
+  </xs:group>
+
+  <xs:group name="solicit-response-or-notification-operation" >
+    <xs:sequence>
+      <xs:element name="output" type="wsdl:tParam" />
+	  <xs:sequence minOccurs='0' >
+	    <xs:element name="input" type="wsdl:tParam" />
+		<xs:element name="fault" type="wsdl:tFault" minOccurs="0" maxOccurs="unbounded" />
+	  </xs:sequence>
+    </xs:sequence>
+  </xs:group>
+        
+  <xs:complexType name="tParam" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleAttributesDocumented" >
+        <xs:attribute name="name" type="xs:NCName" use="optional" />
+        <xs:attribute name="message" type="xs:QName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="tFault" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleAttributesDocumented" >
+        <xs:attribute name="name" type="xs:NCName"  use="required" />
+        <xs:attribute name="message" type="xs:QName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+     
+  <xs:complexType name="tBinding" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:sequence>
+          <xs:element name="operation" type="wsdl:tBindingOperation" minOccurs="0" maxOccurs="unbounded"
/>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+        <xs:attribute name="type" type="xs:QName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+    
+  <xs:complexType name="tBindingOperationMessage" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:attribute name="name" type="xs:NCName" use="optional" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+  
+  <xs:complexType name="tBindingOperationFault" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="tBindingOperation" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:sequence>
+          <xs:element name="input" type="wsdl:tBindingOperationMessage" minOccurs="0"
/>
+          <xs:element name="output" type="wsdl:tBindingOperationMessage" minOccurs="0"
/>
+          <xs:element name="fault" type="wsdl:tBindingOperationFault" minOccurs="0" maxOccurs="unbounded"
/>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+     
+  <xs:complexType name="tService" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:sequence>
+          <xs:element name="port" type="wsdl:tPort" minOccurs="0" maxOccurs="unbounded"
/>
+        </xs:sequence>
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+     
+  <xs:complexType name="tPort" >
+    <xs:complexContent>
+      <xs:extension base="wsdl:tExtensibleDocumented" >
+        <xs:attribute name="name" type="xs:NCName" use="required" />
+        <xs:attribute name="binding" type="xs:QName" use="required" />
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:attribute name="arrayType" type="xs:string" />
+  <xs:attribute name="required" type="xs:boolean" />
+  <xs:complexType name="tExtensibilityElement" abstract="true" >
+    <xs:attribute ref="wsdl:required" use="optional" />
+  </xs:complexType>
+
+</xs:schema>
\ No newline at end of file

Added: geronimo/trunk/modules/axis-builder/src/schema/xmlconfig.xml
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis-builder/src/schema/xmlconfig.xml?rev=201795&view=auto
==============================================================================
--- geronimo/trunk/modules/axis-builder/src/schema/xmlconfig.xml (added)
+++ geronimo/trunk/modules/axis-builder/src/schema/xmlconfig.xml Sat Jun 25 15:19:42 2005
@@ -0,0 +1,13 @@
+<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config"
+    >
+
+    <xb:namespace uri="http://www.w3.org/2001/XMLSchema">
+        <xb:package>org.apache.geronimo.xbeans.schema</xb:package>
+    </xb:namespace>
+
+    <xb:namespace uri="http://schemas.xmlsoap.org/wsdl/">
+        <xb:package>org.apache.geronimo.xbeans.wsdl</xb:package>
+    </xb:namespace>
+
+
+</xb:config>
\ No newline at end of file

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?rev=201795&r1=201794&r2=201795&view=diff
==============================================================================
--- 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
Sat Jun 25 15:19:42 2005
@@ -16,23 +16,12 @@
  */
 package org.apache.geronimo.axis.server;
 
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.OutputStream;
 import java.net.URI;
 import java.util.Iterator;
 import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
-import javax.wsdl.Definition;
 import javax.wsdl.OperationType;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
 import javax.xml.soap.MimeHeader;
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPMessage;
@@ -58,6 +47,7 @@
 public class AxisWebServiceContainer implements WebServiceContainer {
     public static final String REQUEST = AxisWebServiceContainer.class.getName() + "@Request";
     public static final String RESPONSE = AxisWebServiceContainer.class.getName() + "@Response";
+    public static final String LOCATION_REPLACEMENT_TOKEN = "LOCATIONREPLACEMENTTOKEN";
 
     private static Log log = LogFactory.getLog(AxisWebServiceContainer.class);
 
@@ -69,16 +59,16 @@
 
     private final ClassLoader classLoader;
     private final Map wsdlMap;
-    private transient WSDLWriter wsdlWriter;
+//    private transient WSDLWriter wsdlWriter;
 
-    public AxisWebServiceContainer(URI location, URI wsdlURL, SOAPService service, Map wsdlMap,
ClassLoader classLoader) throws WSDLException {
+    public AxisWebServiceContainer(URI location, URI wsdlURL, SOAPService service, Map wsdlMap,
ClassLoader classLoader) {
         this.location = location;
         this.wsdlLocation = wsdlURL;
         this.service = service;
         this.wsdlMap = wsdlMap;
         this.classLoader = classLoader;
-        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-        wsdlWriter = wsdlFactory.newWSDLWriter();
+//        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+//        wsdlWriter = wsdlFactory.newWSDLWriter();
     }
 
     public void invoke(Request req, Response res) throws Exception {
@@ -252,67 +242,75 @@
         if (wsdl == null) {
             throw new IllegalStateException("No wsdl or schema known at location: " + locationKey);
         }
-        if (wsdl instanceof String) {
+//        if (wsdl instanceof String) {
 //            log.info("===========XSD==============" + locationKey);
 //            log.info(wsdl);
+            URI updated = new URI(realLocation.getScheme(),
+                    realLocation.getUserInfo(),
+                    realLocation.getHost(),
+                    realLocation.getPort(),
+                    realLocation.getPath(), //TODO this is very wrong for services containing
more than one port.
+                    null,
+                    null);
+            ((String)wsdl).replaceAll(LOCATION_REPLACEMENT_TOKEN, updated.toString());
             response.getOutputStream().write(((String)wsdl).getBytes());
-        } else {
-            Definition definition = (Definition) wsdl;
-            synchronized (definition) {
-                Map services = definition.getServices();
-                for (Iterator iter1 = services.values().iterator(); iter1.hasNext();) {
-                    Service service = (Service) iter1.next();
-                    Map ports = service.getPorts();
-                    for (Iterator iter2 = ports.values().iterator(); iter2.hasNext();) {
-                        Port port = (Port) iter2.next();
-                        for (Iterator iter3 = port.getExtensibilityElements().iterator();
iter3.hasNext();) {
-                            ExtensibilityElement element = (ExtensibilityElement) iter3.next();
-                            if (element instanceof SOAPAddress) {
-                                SOAPAddress soapAddress = (SOAPAddress) element;
-                                // We replace the host and port here.
-                                String oldLocation = soapAddress.getLocationURI();
-                                URI oldLocationURI = new URI(oldLocation);
-                                URI updated = new URI(realLocation.getScheme(),
-                                        realLocation.getUserInfo(),
-                                        realLocation.getHost(),
-                                        realLocation.getPort(),
-                                        oldLocationURI.getPath(), // Humm is this right?
-                                        null,
-                                        null);
-                                soapAddress.setLocationURI(updated.toString());
-                            }
-                        }
-                    }
-                }
+//        } else {
+//             Definition definition = (Definition) wsdl;
+//            synchronized (definition) {
+//                Map services = definition.getServices();
+//                for (Iterator iter1 = services.values().iterator(); iter1.hasNext();) {
+//                    Service service = (Service) iter1.next();
+//                    Map ports = service.getPorts();
+//                    for (Iterator iter2 = ports.values().iterator(); iter2.hasNext();)
{
+//                        Port port = (Port) iter2.next();
+//                        for (Iterator iter3 = port.getExtensibilityElements().iterator();
iter3.hasNext();) {
+//                            ExtensibilityElement element = (ExtensibilityElement) iter3.next();
+//                            if (element instanceof SOAPAddress) {
+//                                SOAPAddress soapAddress = (SOAPAddress) element;
+//                                // We replace the host and port here.
+//                                String oldLocation = soapAddress.getLocationURI();
+//                                URI oldLocationURI = new URI(oldLocation);
+//                                URI updated = new URI(realLocation.getScheme(),
+//                                        realLocation.getUserInfo(),
+//                                        realLocation.getHost(),
+//                                        realLocation.getPort(),
+//                                        oldLocationURI.getPath(), // Humm is this right?
+//                                        null,
+//                                        null);
+//                                soapAddress.setLocationURI(updated.toString());
+//                            }
+//                        }
+//                    }
+//                }
 //                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);
-
-            }
-        }
+//                OutputStream out = response.getOutputStream();
+//                wsdlWriter.writeWSDL(definition, out);
+//
+//            }
+//        }
     }
 
     public URI getLocation() {
         return location;
     }
 
-    private void readObject(ObjectInputStream in) throws IOException {
-        try {
-            in.defaultReadObject();
-        } catch (ClassNotFoundException e) {
-            throw (IOException)new IOException("Could not deserialize!").initCause(e);
-        }
-        try {
-            WSDLFactory wsdlFactory = WSDLFactory.newInstance();
-            wsdlWriter = wsdlFactory.newWSDLWriter();
-        } catch (WSDLException e) {
-            throw (IOException)new IOException("Could not construct transient wsdlWriter").initCause(e);
-        }
-    }
+//    private void readObject(ObjectInputStream in) throws IOException {
+//        try {
+//            in.defaultReadObject();
+//        } catch (ClassNotFoundException e) {
+//            throw (IOException)new IOException("Could not deserialize!").initCause(e);
+//        }
+//        try {
+//            WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+//            wsdlWriter = wsdlFactory.newWSDLWriter();
+//        } catch (WSDLException e) {
+//            throw (IOException)new IOException("Could not construct transient wsdlWriter").initCause(e);
+//        }
+//    }
 
 }



Mime
View raw message