You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/05/16 12:43:37 UTC

svn commit: r406902 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/ codegen/test/org/apache/axis2/wsdl/ common/src/org/apache/axis2/wsdl/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/...

Author: chinthaka
Date: Tue May 16 03:43:36 2006
New Revision: 406902

URL: http://svn.apache.org/viewcvs?rev=406902&view=rev
Log:
First steps in integrating Woden M1 support to Axis2
 - refactored the WSDL2AxisServiceBuilder in to WSDL11ToAxisServiceBuilder
 - introduced a new base class WSDL2AxisServiceBuilder

Added:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
      - copied, changed from r405718, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
Removed:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=406902&r1=406901&r2=406902&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Tue May 16 03:43:36 2006
@@ -17,8 +17,8 @@
 package org.apache.axis2.wsdl.codegen;
 
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.util.XMLUtils;
-import org.apache.axis2.description.WSDL2AxisServiceBuilder;
 import org.apache.axis2.wsdl.codegen.emitter.Emitter;
 import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension;
 import org.apache.axis2.wsdl.databinding.TypeMapper;
@@ -32,12 +32,12 @@
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
-import javax.wsdl.WSDLException;
 import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
-import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.namespace.QName;
+import javax.xml.parsers.ParserConfigurationException;
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -84,7 +84,7 @@
                 serviceQname = new QName(wsdl4jDef.getTargetNamespace(), configuration.getServiceName());
             }
 
-            configuration.setAxisService(new WSDL2AxisServiceBuilder(
+            configuration.setAxisService(new WSDL11ToAxisServiceBuilder(
                     wsdl4jDef,
                     serviceQname,
                     configuration.getPortName()).

Modified: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java?rev=406902&r1=406901&r2=406902&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java Tue May 16 03:43:36 2006
@@ -5,7 +5,7 @@
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.WSDL2AxisServiceBuilder;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.engine.ListenerManager;
 
 import java.io.File;
@@ -62,7 +62,7 @@
                         continue;
                     }
                     try {
-                        WSDL2AxisServiceBuilder builder = new WSDL2AxisServiceBuilder(new FileInputStream(file1), null, null);
+                        WSDL11ToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(new FileInputStream(file1), null, null);
                         AxisService service = builder.populateService();
                         System.out.println("Testinf file: " + file1.getName());
                         configContext.getAxisConfiguration().addService(service);
@@ -72,7 +72,7 @@
                         out.close();
 //                        URL wsdlURL = new URL("http://localhost:" + 6060 +
 //                                "/axis2/services/" + service.getName() + "?wsdl");
-//                        builder = new WSDL2AxisServiceBuilder(wsdlURL.openStream(), null, null);
+//                        builder = new WSDL11ToAxisServiceBuilder(wsdlURL.openStream(), null, null);
 //                        service = builder.populateService();
                         configContext.getAxisConfiguration().removeService(service.getName());
                     } catch (Exception e) {

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java?rev=406902&r1=406901&r2=406902&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/wsdl/WSDLConstants.java Tue May 16 03:43:36 2006
@@ -28,6 +28,7 @@
     String STYLE_MSG = "msg";
 
     String WSDL_4_J_DEFINITION  = "wsdl4jDefinition";
+    String WSDL_20_DESCRIPTION  = "WSDL20Description";
     /**
      * Field WSDL2_0_NAMESPACE
      */

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=406902&r1=406901&r2=406902&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java Tue May 16 03:43:36 2006
@@ -27,7 +27,13 @@
 import org.apache.axis2.deployment.scheduler.SchedulerTask;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.*;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.AxisServiceGroup;
+import org.apache.axis2.description.Flow;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
@@ -37,7 +43,15 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -247,8 +261,8 @@
                 if (wsdlStream == null) {
                     wsdlStream = serviceClassLoader.getResourceAsStream(metainf + "/" + serviceName + ".wsdl");
                     if (wsdlStream != null) {
-                        WSDL2AxisServiceBuilder wsdl2AxisServiceBuilder =
-                                new WSDL2AxisServiceBuilder(wsdlStream, null, null);
+                        WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
+                                new WSDL11ToAxisServiceBuilder(wsdlStream, null, null);
                         axisService = wsdl2AxisServiceBuilder.populateService();
                         axisService.setWsdlfound(true);
                         axisService.setName(serviceName);
@@ -278,8 +292,8 @@
                     if (wsdlStream == null) {
                         wsdlStream = serviceClassLoader.getResourceAsStream(metainf + "/" + serviceName + ".wsdl");
                         if (wsdlStream != null) {
-                            WSDL2AxisServiceBuilder wsdl2AxisServiceBuilder =
-                                    new WSDL2AxisServiceBuilder(wsdlStream, axisService);
+                            WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
+                                    new WSDL11ToAxisServiceBuilder(wsdlStream, axisService);
                             axisService = wsdl2AxisServiceBuilder.populateService();
                             axisService.setWsdlfound(true);
                             // Set the default message receiver for the operations that were

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=406902&r1=406901&r2=406902&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Tue May 16 03:43:36 2006
@@ -19,13 +19,20 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.deployment.*;
+import org.apache.axis2.deployment.DeploymentConstants;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.DeploymentErrorMsgs;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.DescriptionBuilder;
+import org.apache.axis2.deployment.ModuleBuilder;
+import org.apache.axis2.deployment.ServiceBuilder;
+import org.apache.axis2.deployment.ServiceGroupBuilder;
 import org.apache.axis2.deployment.resolver.AARBasedWSDLLocator;
 import org.apache.axis2.deployment.resolver.AARFileBasedURIResolver;
 import org.apache.axis2.description.AxisModule;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.WSDL2AxisServiceBuilder;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.i18n.Messages;
 import org.apache.commons.logging.Log;
@@ -33,7 +40,13 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
-import java.io.*;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.zip.ZipEntry;
@@ -175,8 +188,8 @@
     private AxisService processWSDLFile(InputStream in, File serviceArchiveFile,
                                         boolean isArchive) throws DeploymentException {
         try {
-            WSDL2AxisServiceBuilder wsdl2AxisServiceBuilder =
-                    new WSDL2AxisServiceBuilder(in, null, null);
+            WSDL11ToAxisServiceBuilder wsdl2AxisServiceBuilder =
+                    new WSDL11ToAxisServiceBuilder(in, null, null);
             if (serviceArchiveFile != null && isArchive) {
                 wsdl2AxisServiceBuilder.setCustomResolver(
                         new AARFileBasedURIResolver(serviceArchiveFile));

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=406902&r1=406901&r2=406902&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 Tue May 16 03:43:36 2006
@@ -57,7 +57,15 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * Class AxisService
@@ -1025,8 +1033,8 @@
                                                           QName wsdlServiceName,
                                                           String portName,
                                                           Options options) throws AxisFault {
-        WSDL2AxisServiceBuilder serviceBuilder =
-                new WSDL2AxisServiceBuilder(wsdlDefinition, wsdlServiceName, portName);
+        WSDL11ToAxisServiceBuilder serviceBuilder =
+                new WSDL11ToAxisServiceBuilder(wsdlDefinition, wsdlServiceName, portName);
         serviceBuilder.setServerSide(false);
         AxisService axisService = serviceBuilder.populateService();
         options.setTo(new EndpointReference(axisService.getEndpoint()));

Copied: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (from r405718, webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java)
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?p2=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java&p1=webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java&r1=405718&r2=406902&rev=406902&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Tue May 16 03:43:36 2006
@@ -2,24 +2,36 @@
 
 import com.ibm.wsdl.extensions.soap.SOAPConstants;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.SOAPHeaderMessage;
 import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.resolver.URIResolver;
 import org.apache.ws.policy.Policy;
 import org.apache.ws.policy.PolicyConstants;
 import org.apache.ws.policy.PolicyReference;
 import org.apache.ws.policy.util.DOMPolicyReader;
 import org.apache.ws.policy.util.PolicyFactory;
-import org.apache.ws.policy.util.PolicyRegistry;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-import javax.wsdl.*;
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.OperationType;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.UnknownExtensibilityElement;
 import javax.wsdl.extensions.schema.Schema;
@@ -31,12 +43,16 @@
 import javax.wsdl.xml.WSDLLocator;
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
 
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
@@ -56,54 +72,12 @@
  *
  */
 
-public class WSDL2AxisServiceBuilder {
+public class WSDL11ToAxisServiceBuilder extends WSDLToAxisServiceBuilder{
 
-    private static final String XMLSCHEMA_NAMESPACE_URI = Constants.URI_2001_SCHEMA_XSD;
 
-    private static final String XMLSCHEMA_NAMESPACE_PREFIX = "xs";
-
-    private static final String XML_SCHEMA_LOCAL_NAME = "schema";
-
-    private static final String XML_SCHEMA_SEQUENCE_LOCAL_NAME = "sequence";
-
-    private static final String XML_SCHEMA_COMPLEX_TYPE_LOCAL_NAME = "complexType";
-
-    private static final String XML_SCHEMA_ELEMENT_LOCAL_NAME = "element";
-
-    private static final String XML_SCHEMA_IMPORT_LOCAL_NAME = "import";
-
-    private static final String XSD_NAME = "name";
-
-    private static final String XSD_TARGETNAMESPACE = "targetNamespace";
-
-    private static final String XMLNS_AXIS2WRAPPED = "xmlns:axis2wrapped";
-
-    private static final String AXIS2WRAPPED = "axis2wrapped";
-
-    private static final String XSD_TYPE = "type";
-
-    private static final String XSD_REF = "ref";
-
-    private static int nsCount = 0;
-
-    private Map resolvedRpcWrappedElementMap = new HashMap();
-
-    private static final String XSD_ELEMENT_FORM_DEFAULT = "elementFormDefault";
-
-    private static final String XSD_UNQUALIFIED = "unqualified";
-
-    private InputStream in;
-
-    private AxisService axisService;
-
-    private PolicyRegistry registry;
-
-    private QName serviceName;
 
     private String portName;
 
-    private boolean isServerSide = true;
-
     private static final String BINDING = "Binding";
 
     private static final String SERVICE = "Service";
@@ -130,53 +104,32 @@
 
     private Definition wsdl4jDefinition = null;
 
-    private String style = null;
-
-    private URIResolver customResolver;
-
     private WSDLLocator customWSLD4JResolver;
-    private String baseUri = null;
 
 
-    public WSDL2AxisServiceBuilder(InputStream in, QName serviceName,
-                                   String portName) {
-        this.in = in;
-        this.serviceName = serviceName;
+    public WSDL11ToAxisServiceBuilder(InputStream in, QName serviceName,
+                                      String portName) {
+        super(in, serviceName);
         this.portName = portName;
-        this.axisService = new AxisService();
-        setPolicyRegistryFromService(axisService);
     }
 
 
-    public WSDL2AxisServiceBuilder(Definition def, QName serviceName,
-                                   String portName) {
+    public WSDL11ToAxisServiceBuilder(Definition def, QName serviceName,
+                                      String portName) {
+        super(null, serviceName);
         this.wsdl4jDefinition = def;
-        this.serviceName = serviceName;
         this.portName = portName;
-        this.axisService = new AxisService();
-        setPolicyRegistryFromService(axisService);
     }
 
-    public WSDL2AxisServiceBuilder(InputStream in, AxisService service) {
-        this(in);
-        this.axisService = service;
-        setPolicyRegistryFromService(service);
+    public WSDL11ToAxisServiceBuilder(InputStream in, AxisService service) {
+        super(in, service);
     }
 
-    public WSDL2AxisServiceBuilder(InputStream in) {
+    public WSDL11ToAxisServiceBuilder(InputStream in) {
         this(in, null, null);
     }
 
     /**
-     * Sets a custom xmlschema resolver
-     *
-     * @param customResolver
-     */
-    public void setCustomResolver(URIResolver customResolver) {
-        this.customResolver = customResolver;
-    }
-
-    /**
      * sets a custem WSDL4J locator
      *
      * @param customWSLD4JResolver
@@ -185,14 +138,6 @@
         this.customWSLD4JResolver = customWSLD4JResolver;
     }
 
-    public boolean isServerSide() {
-        return isServerSide;
-    }
-
-    public void setServerSide(boolean serverSide) {
-        isServerSide = serverSide;
-    }
-
     public AxisService populateService() throws AxisFault {
         try {
             if (wsdl4jDefinition == null) {
@@ -244,11 +189,6 @@
         }
     }
 
-    private void setPolicyRegistryFromService(AxisService axisService) {
-        PolicyInclude policyInclude = axisService.getPolicyInclude();
-        this.registry = policyInclude.getPolicyRegistry();
-    }
-
     private Binding findBinding(Definition dif) throws AxisFault {
         Map services = dif.getServices();
         Service service;
@@ -940,25 +880,6 @@
         }
     }
 
-    private XmlSchema getXMLSchema(Element element, String baseUri) {
-        XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
-        Map nsMap = axisService.getNameSpacesMap();
-        Iterator keys = nsMap.keySet().iterator();
-        String key;
-        while (keys.hasNext()) {
-            key = (String) keys.next();
-            schemaCollection.mapNamespace(key, (String) nsMap.get(key));
-        }
-
-        if (baseUri != null) schemaCollection.setBaseUri(baseUri);
-
-        if (customResolver != null) {
-            schemaCollection.setSchemaResolver(customResolver);
-        }
-
-        return schemaCollection.read(element);
-    }
-
     private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
 
         WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
@@ -1284,51 +1205,6 @@
         return wrappable;
     }
 
-    /**
-     * Find the XML schema prefix
-     */
-    private String findSchemaPrefix() {
-        String xsdPrefix = null;
-        Map declaredNameSpaces = axisService.getNameSpacesMap();
-        if (declaredNameSpaces.containsValue(XMLSCHEMA_NAMESPACE_URI)) {
-            //loop and find the prefix
-            Iterator it = declaredNameSpaces.keySet().iterator();
-            String key;
-            while (it.hasNext()) {
-                key = (String) it.next();
-                if (XMLSCHEMA_NAMESPACE_URI.equals(declaredNameSpaces.get(key))) {
-                    xsdPrefix = key;
-                    break;
-                }
-            }
-        } else {
-            xsdPrefix = XMLSCHEMA_NAMESPACE_PREFIX; //default prefix
-        }
-        return xsdPrefix;
-    }
-
-    /**
-     * Utility method that returns a DOM Builder
-     */
-    private DocumentBuilder getDOMDocumentBuilder() {
-        DocumentBuilder documentBuilder;
-        try {
-            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
-                    .newInstance();
-            documentBuilderFactory.setNamespaceAware(true);
-            documentBuilder = documentBuilderFactory.newDocumentBuilder();
-        } catch (ParserConfigurationException e) {
-            throw new RuntimeException(e);
-        }
-        return documentBuilder;
-    }
-
-    /**
-     */
-    private String getTemporaryNamespacePrefix() {
-        return "ns" + nsCount++;
-    }
-
     private String getMEP(Operation operation) throws Exception {
         OperationType operationType = operation.getStyle();
         if (isServerSide) {
@@ -1417,14 +1293,6 @@
                 }
             }
         }
-    }
-
-    public String getBaseUri() {
-        return baseUri;
-    }
-
-    public void setBaseUri(String baseUri) {
-        this.baseUri = baseUri;
     }
 
 }

Added: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java?rev=406902&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java (added)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java Tue May 16 03:43:36 2006
@@ -0,0 +1,188 @@
+package org.apache.axis2.description;
+
+import org.apache.axis2.namespace.Constants;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.resolver.URIResolver;
+import org.apache.ws.policy.util.PolicyRegistry;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public abstract class WSDLToAxisServiceBuilder {
+
+    protected static final String XMLSCHEMA_NAMESPACE_URI = Constants.URI_2001_SCHEMA_XSD;
+
+    protected static final String XMLSCHEMA_NAMESPACE_PREFIX = "xs";
+
+    protected static final String XML_SCHEMA_LOCAL_NAME = "schema";
+
+    protected static final String XML_SCHEMA_SEQUENCE_LOCAL_NAME = "sequence";
+
+    protected static final String XML_SCHEMA_COMPLEX_TYPE_LOCAL_NAME = "complexType";
+
+    protected static final String XML_SCHEMA_ELEMENT_LOCAL_NAME = "element";
+
+    protected static final String XML_SCHEMA_IMPORT_LOCAL_NAME = "import";
+
+    protected static final String XSD_NAME = "name";
+
+    protected static final String XSD_TARGETNAMESPACE = "targetNamespace";
+
+    protected static final String XMLNS_AXIS2WRAPPED = "xmlns:axis2wrapped";
+
+    protected static final String AXIS2WRAPPED = "axis2wrapped";
+
+    protected static final String XSD_TYPE = "type";
+
+    protected static final String XSD_REF = "ref";
+
+    protected static int nsCount = 0;
+
+    protected Map resolvedRpcWrappedElementMap = new HashMap();
+
+    protected static final String XSD_ELEMENT_FORM_DEFAULT = "elementFormDefault";
+
+    protected static final String XSD_UNQUALIFIED = "unqualified";
+
+    protected InputStream in;
+
+    protected AxisService axisService;
+
+    protected PolicyRegistry registry;
+
+    protected QName serviceName;
+    protected boolean isServerSide = true;
+    protected String style = null;
+    private URIResolver customResolver;
+    private String baseUri = null;
+
+    public WSDLToAxisServiceBuilder(InputStream in, QName serviceName) {
+        this.in = in;
+        this.serviceName = serviceName;
+        this.axisService = new AxisService();
+        setPolicyRegistryFromService(axisService);
+    }
+
+    public WSDLToAxisServiceBuilder(InputStream in, AxisService axisService) {
+        this.in = in;
+        this.axisService = axisService;
+        setPolicyRegistryFromService(axisService);
+    }
+
+    /**
+     * Sets a custom xmlschema resolver
+     *
+     * @param customResolver
+     */
+    public void setCustomResolver(URIResolver customResolver) {
+        this.customResolver = customResolver;
+    }
+
+    public boolean isServerSide() {
+        return isServerSide;
+    }
+
+    public void setServerSide(boolean serverSide) {
+        isServerSide = serverSide;
+    }
+
+    protected void setPolicyRegistryFromService(AxisService axisService) {
+        PolicyInclude policyInclude = axisService.getPolicyInclude();
+        this.registry = policyInclude.getPolicyRegistry();
+    }
+
+    protected XmlSchema getXMLSchema(Element element, String baseUri) {
+        XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
+        Map nsMap = axisService.getNameSpacesMap();
+        Iterator keys = nsMap.keySet().iterator();
+        String key;
+        while (keys.hasNext()) {
+            key = (String) keys.next();
+            schemaCollection.mapNamespace(key, (String) nsMap.get(key));
+        }
+
+        if (baseUri != null) schemaCollection.setBaseUri(baseUri);
+
+        if (customResolver != null) {
+            schemaCollection.setSchemaResolver(customResolver);
+        }
+
+        return schemaCollection.read(element);
+    }
+
+    /**
+     * Find the XML schema prefix
+     */
+    protected String findSchemaPrefix() {
+        String xsdPrefix = null;
+        Map declaredNameSpaces = axisService.getNameSpacesMap();
+        if (declaredNameSpaces.containsValue(XMLSCHEMA_NAMESPACE_URI)) {
+            //loop and find the prefix
+            Iterator it = declaredNameSpaces.keySet().iterator();
+            String key;
+            while (it.hasNext()) {
+                key = (String) it.next();
+                if (XMLSCHEMA_NAMESPACE_URI.equals(declaredNameSpaces.get(key))) {
+                    xsdPrefix = key;
+                    break;
+                }
+            }
+        } else {
+            xsdPrefix = XMLSCHEMA_NAMESPACE_PREFIX; //default prefix
+        }
+        return xsdPrefix;
+    }
+
+    /**
+     * Utility method that returns a DOM Builder
+     */
+    protected DocumentBuilder getDOMDocumentBuilder() {
+        DocumentBuilder documentBuilder;
+        try {
+            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory
+                    .newInstance();
+            documentBuilderFactory.setNamespaceAware(true);
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e);
+        }
+        return documentBuilder;
+    }
+
+    /**
+     */
+    protected String getTemporaryNamespacePrefix() {
+        return "ns" + nsCount++;
+    }
+
+    public String getBaseUri() {
+        return baseUri;
+    }
+
+    public void setBaseUri(String baseUri) {
+        this.baseUri = baseUri;
+    }
+}