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 bu...@apache.org on 2002/05/09 15:14:30 UTC

cvs commit: xml-axis/java/test/wsdl Wsdl2javaAntTask.java

butek       02/05/09 06:14:29

  Modified:    java/src/org/apache/axis/description ParameterDesc.java
               java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/src/org/apache/axis/wsdl WSDL2Java.java
               java/src/org/apache/axis/wsdl/toJava Emitter.java
                        JavaBeanHelperWriter.java JavaBeanWriter.java
                        JavaBindingWriter.java JavaDefinitionWriter.java
                        JavaDeployWriter.java JavaEnumTypeWriter.java
                        JavaFaultWriter.java JavaHolderWriter.java
                        JavaImplWriter.java JavaInterfaceWriter.java
                        JavaServiceIfaceWriter.java
                        JavaServiceImplWriter.java JavaServiceWriter.java
                        JavaSkelWriter.java JavaStubWriter.java
                        JavaTestCaseWriter.java JavaTypeWriter.java
                        JavaUndeployWriter.java JavaWriter.java Utils.java
               java/test/wsdl Wsdl2javaAntTask.java
  Added:       java/src/org/apache/axis/wsdl/gen Generator.java
                        GeneratorFactory.java NoopFactory.java
                        NoopGenerator.java Parser.java WSDL2.java
               java/src/org/apache/axis/wsdl/symbolTable BaseType.java
                        BaseTypeMapping.java BindingEntry.java
                        CollectionType.java DefinedElement.java
                        DefinedType.java Element.java ElementDecl.java
                        MessageEntry.java Parameter.java Parameters.java
                        PortTypeEntry.java SchemaUtils.java
                        ServiceEntry.java SymTabEntry.java SymbolTable.java
                        Type.java TypeEntry.java Undefined.java
                        UndefinedDelegate.java UndefinedElement.java
                        UndefinedType.java Utils.java
               java/src/org/apache/axis/wsdl/toJava
                        JavaGeneratorFactory.java
  Removed:     java/src/org/apache/axis/wsdl/toJava BaseType.java
                        BaseTypeMapping.java BindingEntry.java
                        CollectionType.java DefinedElement.java
                        DefinedType.java Element.java ElementDecl.java
                        JavaWriterFactory.java MessageEntry.java
                        NoopWriter.java NoopWriterFactory.java
                        Parameter.java Parameters.java PortTypeEntry.java
                        SchemaUtils.java ServiceEntry.java SymTabEntry.java
                        SymbolTable.java Type.java TypeEntry.java
                        Undefined.java UndefinedDelegate.java
                        UndefinedElement.java UndefinedType.java
                        Writer.java WriterFactory.java
  Log:
  Repackage WSDL2Java:
  - org.apache.axis.wsdl.symbolTable contains the symbol table stuff.
  - org.apache.axis.wsdl.gen contains the non-Java/non-JAX-RPC base classes
  - org.apache.axis.wsdl.toJava (and WSDL2Java) remain where they are.
  
  Revision  Changes    Path
  1.8       +3 -2      xml-axis/java/src/org/apache/axis/description/ParameterDesc.java
  
  Index: ParameterDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/description/ParameterDesc.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ParameterDesc.java	8 May 2002 15:34:22 -0000	1.7
  +++ ParameterDesc.java	9 May 2002 13:14:27 -0000	1.8
  @@ -54,10 +54,11 @@
    */
   package org.apache.axis.description;
   
  -import org.apache.axis.wsdl.toJava.TypeEntry;
  +import javax.xml.rpc.namespace.QName;
  +
   import org.apache.axis.utils.JavaUtils;
   
  -import javax.xml.rpc.namespace.QName;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
   
   /**
    * A Parameter descriptor, collecting the interesting info about an
  
  
  
  1.24      +1 -1      xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java
  
  Index: SerializationContextImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/SerializationContextImpl.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SerializationContextImpl.java	29 Apr 2002 13:01:27 -0000	1.23
  +++ SerializationContextImpl.java	9 May 2002 13:14:27 -0000	1.24
  @@ -60,7 +60,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.soap.SOAPConstants;
  -import org.apache.axis.wsdl.toJava.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
   import org.apache.axis.description.ServiceDesc;
   import org.apache.axis.handlers.soap.SOAPService;
   import org.apache.axis.attachments.Attachments;
  
  
  
  1.27      +125 -653  xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java
  
  Index: WSDL2Java.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/WSDL2Java.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- WSDL2Java.java	7 May 2002 19:52:02 -0000	1.26
  +++ WSDL2Java.java	9 May 2002 13:14:27 -0000	1.27
  @@ -54,41 +54,23 @@
    */
   package org.apache.axis.wsdl;
   
  -import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
  -import org.apache.axis.encoding.TypeMapping;
   import org.apache.axis.utils.CLArgsParser;
   import org.apache.axis.utils.CLOption;
   import org.apache.axis.utils.CLOptionDescriptor;
   import org.apache.axis.utils.CLUtil;
   import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.wsdl.toJava.BaseTypeMapping;
  +
  +import org.apache.axis.wsdl.gen.Parser;
  +import org.apache.axis.wsdl.gen.WSDL2;
  +
   import org.apache.axis.wsdl.toJava.Emitter;
  -import org.apache.axis.wsdl.toJava.GeneratedFileInfo;
  -import org.apache.axis.wsdl.toJava.JavaWriterFactory;
  -import org.w3c.dom.Document;
  -
  -import javax.wsdl.Definition;
  -import javax.wsdl.QName;
  -import javax.wsdl.WSDLException;
  -import java.io.File;
  -import java.io.IOException;
  -import java.net.Authenticator;
  -import java.net.PasswordAuthentication;
  -import java.net.MalformedURLException;
  -import java.net.URL;
  -import java.util.HashMap;
  -import java.util.List;
   
   /**
  - * Command line interface to the wsdl2java utility
  + * Command line interface to the WSDL2Java utility
    *
  - * @author Tom Jordahl (tjordahl@macromedia.com)
    */
  -public class WSDL2Java {
  +public class WSDL2Java extends WSDL2 {
       // Define our short one-letter option identifiers.
  -    protected static final int HELP_OPT = 'h';
  -    protected static final int VERBOSE_OPT = 'v';
       protected static final int SERVER_OPT = 's';
       protected static final int SKELETON_DEPLOY_OPT = 'S';
       protected static final int NAMESPACE_OPT = 'N';
  @@ -96,9 +78,7 @@
       protected static final int OUTPUT_OPT = 'o';
       protected static final int SCOPE_OPT = 'd';
       protected static final int TEST_OPT = 't';
  -    protected static final int NOIMPORTS_OPT = 'n';
       protected static final int PACKAGE_OPT = 'p';
  -    protected static final int DEBUG_OPT = 'D';
       protected static final int ALL_OPT = 'a';
       protected static final int TYPEMAPPING_OPT = 'T';
       protected static final int NETWORK_TIMEOUT_OPT = 'O';
  @@ -107,19 +87,8 @@
       protected static final int USERNAME_OPT = 'U';
       protected static final int PASSWORD_OPT = 'P';
   
  -
  -    // Scope constants
  -    public static final byte NO_EXPLICIT_SCOPE = 0x00;
  -    public static final byte APPLICATION_SCOPE = 0x01;
  -    public static final byte REQUEST_SCOPE     = 0x10;
  -    public static final byte SESSION_SCOPE     = 0x11;
  -
  -    // The emitter framework Emitter class.
  -    protected Emitter emitter;
  -    // Timeout, in milliseconds, to let the Emitter do its work
  -    private long timeoutms = 45000; // 45 sec default
  -
  -    protected JavaWriterFactory writerFactory = null;
  +    protected boolean bPackageOpt = false;
  +    private   Emitter emitter;
   
       /**
        *  Define the understood options. Each CLOptionDescriptor contains:
  @@ -131,14 +100,6 @@
        * - A description of the option for the usage message
        */
       protected static final CLOptionDescriptor[] options = new CLOptionDescriptor[]{
  -        new CLOptionDescriptor("help",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                HELP_OPT,
  -                JavaUtils.getMessage("optionHelp00")),
  -        new CLOptionDescriptor("verbose",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                VERBOSE_OPT,
  -                JavaUtils.getMessage("optionVerbose00")),
           new CLOptionDescriptor("server-side",
                   CLOptionDescriptor.ARGUMENT_DISALLOWED,
                   SERVER_OPT,
  @@ -171,18 +132,10 @@
                   CLOptionDescriptor.ARGUMENT_DISALLOWED,
                   TEST_OPT,
                   JavaUtils.getMessage("optionTest00")),
  -        new CLOptionDescriptor("noImports",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                NOIMPORTS_OPT,
  -                JavaUtils.getMessage("optionImport00")),
           new CLOptionDescriptor("all",
                   CLOptionDescriptor.ARGUMENT_DISALLOWED,
                   ALL_OPT,
                   JavaUtils.getMessage("optionAll00")),
  -        new CLOptionDescriptor("Debug",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                DEBUG_OPT,
  -                JavaUtils.getMessage("optionDebug00")),
           new CLOptionDescriptor("typeMappingVersion",
                   CLOptionDescriptor.ARGUMENT_REQUIRED,
                   TYPEMAPPING_OPT,
  @@ -213,573 +166,140 @@
        * Instantiate a WSDL2Java emitter.
        */
       public WSDL2Java() {
  -        // Instantiate the emitter
  -        writerFactory = new JavaWriterFactory();
  -        emitter = new Emitter(writerFactory);
  -        writerFactory.setEmitter(emitter);
  +        // emitter is the same as the parent's parser variable.  Just cast it
  +        // here once so we don't have to cast it every time we use it.
  +        emitter = (Emitter) parser;
  +        addOptions(options);
       } // ctor
   
  -    ///////////////////////////////////////////////////
  -    //
  -    // Command line switches
  -    //
  -
  -    /**
  -     * Turn on/off server skeleton creation
  -     * @param boolean value
  -     */
  -    public void generateServerSide(boolean value) {
  -        emitter.generateServerSide(value);
  -    }
  -
  -    /**
  -     * Indicate if we should be emitting server side code and deploy/undeploy
  -     */
  -    public boolean getGenerateServerSide() {
  -        return emitter.getGenerateServerSide();
  -    }
  -
  -    /**
  -     * Turn on/off server skeleton deploy
  -     * @param boolean value
  -     */
  -    public void deploySkeleton(boolean value) {
  -        emitter.deploySkeleton(value);
  -    }
  -
  -    /**
  -     * Indicate if we should be deploying skeleton or implementation
  -     */
  -    public boolean getDeploySkeleton() {
  -        return emitter.getDeploySkeleton();
  -    }
  -
  -    /**
  -     * Turn on/off test case creation
  -     * @param boolean value
  -     */
  -    public void generateTestCase(boolean value) {
  -        emitter.generateTestCase(value);
  -    }
  -
  -    /**
  -     * Return the current definition
  -     */
  -    public Definition getCurrentDefinition() {
  -        return emitter.getCurrentDefinition();
  -    }
  -
  -    /**
  -     * Turn on/off generation of elements from imported files.
  -     * @param boolean generateImports
  -     */
  -    public void generateImports(boolean generateImports) {
  -        emitter.generateImports(generateImports);
  -    } // generateImports
  -
  -    /**
  -     * By default, code is generated only for referenced elements.
  -     * Call generateAll(true) and WSDL2Java will generate code for all
  -     * elements in the scope regardless of whether they are
  -     * referenced.  Scope means:  by default, all WSDL files; if
  -     * generateImports(false), then only the immediate WSDL file.
  -     */
  -     public void generateAll(boolean all) {
  -         emitter.generateAll(all);
  -     } // generateAll
  -
  -    /**
  -     * Turn on/off debug messages.
  -     * @param boolean value
  -     */
  -    public void debug(boolean value) {
  -        emitter.debug(value);
  -    } // debug
  -
  -    /**
  -     * Return the status of the debug switch.
  -     */
  -    public boolean getDebug() {
  -        return emitter.getDebug();
  -    } // getDebug
  -
  -
  -    /**
  -     * Indicate writer factory
  -     * @param String class name
  -     */
  -    public void factory(String value) {
  -        emitter.setFactory(value);
  -    }
  -
  -    /**
  -     * Indicate helper Generation s
  -     * @param boolean value
  -     */
  -    public void helperGen(boolean value) {
  -        emitter.setHelperGeneration(value);
  -    }
  -
  -    /**
  -     * Indicate helper Generation s
  -     * @param boolean value
  -     */
  -    public boolean getHelperGen() {
  -        return emitter.getHelperGeneration();
  -    }
  -
  -    /**
  -     * Turn on/off verbose messages
  -     * @param boolean value
  -     */
  -    public void verbose(boolean value) {
  -        emitter.verbose(value);
  -    }
  -
  -    /**
  -     * Return the status of the verbose switch
  -     */
  -    public boolean getVerbose() {
  -        return emitter.getVerbose();
  -    }
  -
  -    /**
  -     * Set a map of namespace -> Java package names
  -     */
  -    public void setNamespaceMap(HashMap map) {
  -        emitter.setNamespaceMap(map);
  -    }
  -
  -
  -    /**
  -     * Set the output directory to use in emitted source files
  -     */
  -    public void setOutputDir(String outputDir) {
  -        emitter.setOutputDir(outputDir);
  -    }
  -
  -    /**
  -     * Get global package name to use instead of mapping namespaces
  -     */
  -    public String getPackageName() {
  -        return emitter.getPackageName();
  -    }
  -
  -    /**
  -     * Set a global package name to use instead of mapping namespaces
  -     */
  -    public void setPackageName(String packageName) {
  -        emitter.setPackageName(packageName);
  -    }
  -
  -    /**
  -     * Get the output directory to use for emitted source files
  -     */
  -    public String getOutputDir() {
  -        return emitter.getOutputDir();
  -    }
  -
  -    /**
  -     * Set the scope for the deploy.xml file.
  -     * @param scope One of Emitter.NO_EXPLICIT_SCOPE, Emitter.APPLICATION_SCOPE, Emitter.REQUEST_SCOPE, Emitter.SESSION_SCOPE.  Anything else is equivalent to NO_EXPLICIT_SCOPE and no explicit scope tag will appear in deploy.xml.
  -     */
  -    public void setScope(byte scope) {
  -        emitter.setScope(scope);
  -    } // setScope
  -
  -    /**
  -     * Get the scope for the deploy.xml file.
  -     */
  -    public byte getScope() {
  -        return emitter.getScope();
  -    } // getScope
  -
  -    /**
  -     * Set the NStoPkg mappings filename.
  -     */
  -    public void setNStoPkg(String NStoPkgFilename) {
  -        emitter.setNStoPkg(NStoPkgFilename);
  -    } // setNStoPkg
  -
  -    /**
  -     * Set the NStoPkg mappings file.
  -     */
  -    public void setNStoPkg(File NStoPkgFile) {
  -        emitter.setNStoPkg(NStoPkgFile);
  -    } // setNStoPkg
  -
  -    /**
  -     * Return the current timeout setting
  -     */
  -    public long getTimeout() {
  -        return timeoutms;
  -    }
  -
  -    /**
  -     * Set the timeout, in milliseconds
  -     */
  -    public void setTimeout(long timeout) {
  -        this.timeoutms = timeout;
  -    }
  -
  -    public String getUsername() {
  -        return emitter.getUsername();
  -    }
  -
  -    public void setUsername(String username) {
  -        emitter.setUsername(username);
  -    }
  -
  -    public String getPassword() {
  -        return emitter.getPassword();
  -    }
  -
  -    public void setPassword(String password) {
  -        emitter.setPassword(password);
  -    }
  -
  -    //
  -    // Command line switches
  -    //
  -    ///////////////////////////////////////////////////
  -
  -    /**
  -     * Returns an object which contains of information on all generated files
  -     * including the class name, filename and a type string.
  -     *
  -     * @return An org.apache.axis.wsdl.toJava.GeneratedFileInfo object
  -     * @see org.apache.axis.wsdl.toJava.GeneratedFileInfo
  -     */
  -    public GeneratedFileInfo getGeneratedFileInfo()
  -    {
  -        return emitter.getGeneratedFileInfo();
  -    }
  -
  -    /**
  -     * Return a list of all generated class names.
  -     *
  -     * @return list of class names (strings)
  -     */
  -    public List getGeneratedClassNames() {
  -        return emitter.getGeneratedClassNames();
  -    }
  -
  -    /**
  -     * Return a list of all generated file names.
  -     *
  -     * @return list of relative path names (strings)
  -     */
  -    public List getGeneratedFileNames() {
  -        return emitter.getGeneratedFileNames();
  -    }
  -
  -
  -    /**
  -     * Emit appropriate Java files for a WSDL at a given URL.
  -     *
  -     * This method will time out after the number of milliseconds specified
  -     * by our timeoutms member.
  -     *
  -     * @param String wsdlURI the location of the WSDL file.
  -     */
  -    public void emit(String wsdlURL)
  -            throws Exception {
  +    protected Parser createParser() {
  +        return new Emitter();
  +    } // createParser
  +
  +    protected void parseOption(CLOption option) {
  +        switch (option.getId()) {
  +            case FACTORY_CLASS_OPT:
  +                emitter.setFactory(option.getArgument());
  +                break;
  +
  +            case HELPER_CLASS_OPT:
  +                emitter.setHelperGeneration(true);
  +                break;
  +
  +            case SKELETON_DEPLOY_OPT:
  +                String skeletonDeploy = option.getArgument(0);
  +                if (skeletonDeploy.equalsIgnoreCase("true"))
  +                    emitter.setDeploySkeleton(true);
  +                else
  +                    emitter.setDeploySkeleton(false);
  +
  +            case SERVER_OPT:
  +                emitter.setGenerateServerSide(true);
  +                break;
  +
  +            case NAMESPACE_OPT:
  +                String namespace = option.getArgument(0);
  +                String packageName = option.getArgument(1);
  +                emitter.getNamespaceMap().put(namespace, packageName);
  +                break;
  +
  +            case NAMESPACE_FILE_OPT:
  +                emitter.setNStoPkg(option.getArgument());
  +                break;
  +
  +            case PACKAGE_OPT:
  +                bPackageOpt = true;
  +                emitter.setPackageName(option.getArgument());
  +                break;
  +
  +            case OUTPUT_OPT:
  +                emitter.setOutputDir(option.getArgument());
  +                break;
  +
  +            case SCOPE_OPT:
  +                String scope = option.getArgument();
  +                if ("Application".equals(scope)) {
  +                    emitter.setScope(emitter.APPLICATION_SCOPE);
  +                }
  +                else if ("Request".equals(scope)) {
  +                    emitter.setScope(emitter.REQUEST_SCOPE);
  +                }
  +                else if ("Session".equals(scope)) {
  +                    emitter.setScope(emitter.SESSION_SCOPE);
  +                }
  +                else {
  +                    System.err.println(
  +                            JavaUtils.getMessage("badScope00", scope));
  +                }
  +                break;
   
  -        // We run the actual Emitter in a thread that we can kill
  -        WSDLRunnable runnable = new WSDLRunnable(emitter, wsdlURL);
  -        Thread wsdlThread = new Thread(runnable);
  -
  -        wsdlThread.start();
  -
  -        try {
  -            if (timeoutms > 0)
  -                wsdlThread.join(timeoutms);
  -            else
  -                wsdlThread.join();
  -        } catch (InterruptedException e) {
  -        }
  +            case TEST_OPT:
  +                emitter.setGenerateTestCase(true);
  +                break;
  +
  +            case ALL_OPT:
  +                emitter.setGenerateAll(true);
  +                break;
  +
  +            case TYPEMAPPING_OPT:
  +                String tmValue = option.getArgument();
  +                if (tmValue.equals("1.1")) {
  +                    emitter.setTypeMappingVersion("1.1");
  +                } else if (tmValue.equals("1.2")) {
  +                    emitter.setTypeMappingVersion("1.2");
  +                } else {
  +                    System.out.println(JavaUtils.getMessage("badTypeMappingOption00"));
  +                }
  +                break;
   
  -        if (wsdlThread.isAlive()) {
  -            wsdlThread.interrupt();
  -            throw new Exception(JavaUtils.getMessage("timedOut"));
  +            case NETWORK_TIMEOUT_OPT:
  +                String timeoutValue = option.getArgument();
  +                long timeout = Long.parseLong(timeoutValue);
  +                        // Convert seconds to milliseconds.
  +                if(timeout > 0)
  +                    timeout = timeout * 1000;
  +                emitter.setTimeout(timeout);
  +                break;
  +
  +            case USERNAME_OPT:
  +                emitter.setUsername(option.getArgument());
  +                break;
  +
  +            case PASSWORD_OPT:
  +                emitter.setPassword(option.getArgument());
  +                break;
  +
  +            default:
  +                super.parseOption(option);
  +        }
  +    } // parseOption
  +
  +    protected void validateOptions() {
  +        super.validateOptions();
  +
  +        // validate argument combinations
  +        if (emitter.deploySkeleton() && !emitter.generateServerSide()) {
  +            System.out.println(JavaUtils.getMessage("badSkeleton00"));
  +            printUsage();
           }
  -
  -        if (runnable.getFailure() != null) {
  -            throw runnable.getFailure();
  +        if (!emitter.getNamespaceMap().isEmpty() && bPackageOpt) {
  +            System.out.println(JavaUtils.getMessage("badpackage00"));
  +            printUsage();
           }
  -    } // emit
  -
  -    /**
  -     * Call this method if your WSDL document has already been parsed as an XML DOM document.
  -     * @param String context This is directory context for the Document.  If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work).  If context is null, then the context becomes the current directory.
  -     * @param Document doc This is the XML Document containing the WSDL.
  -     */
  -    public void emit(String context, Document doc)
  -            throws IOException, WSDLException {
  -        emitter.emit(context, doc);
  -    } // emit
  +    } // validateOptions
   
       /**
        * Main
        */
       public static void main(String args[]) {
           WSDL2Java wsdl2java = new WSDL2Java();
  -        boolean bServer = false;
  -        String skeletonDeploy = null;
  -        boolean bTestClass = false;
  -        String wsdlURI = null;
  -        HashMap namespaceMap = new HashMap();
  -        boolean bPackageOpt = false;
  -        String typeMappingVersion = "1.2";
  -
  -        // Parse the arguments
  -        CLArgsParser parser = new CLArgsParser(args, options);
  -
  -        // Print parser errors, if any
  -        if (null != parser.getErrorString()) {
  -            System.err.println(
  -                    JavaUtils.getMessage("error01", parser.getErrorString()));
  -            printUsage();
  -        }
  -
  -        // Get a list of parsed options
  -        List clOptions = parser.getArguments();
  -        int size = clOptions.size();
  -
  -        try {
  -            // Parse the options and configure the emitter as appropriate.
  -            for (int i = 0; i < size; i++) {
  -                CLOption option = (CLOption)clOptions.get(i);
  -
  -                switch (option.getId()) {
  -                    case CLOption.TEXT_ARGUMENT:
  -                        if (wsdlURI != null) {
  -                            printUsage();
  -                        }
  -                        wsdlURI = option.getArgument();
  -                        break;
  -
  -                    case HELP_OPT:
  -                        printUsage();
  -                        break;
  -
  -                    case VERBOSE_OPT:
  -                        wsdl2java.verbose(true);
  -                        break;
  -
  -                    case FACTORY_CLASS_OPT:
  -                        wsdl2java.factory(option.getArgument());
  -                        break;
  -
  -                    case HELPER_CLASS_OPT:
  -                        wsdl2java.helperGen(true);
  -                        break;
  -
  -                    case SKELETON_DEPLOY_OPT:
  -                        skeletonDeploy = option.getArgument(0);
  -                        if (skeletonDeploy.equalsIgnoreCase("true"))
  -                            wsdl2java.deploySkeleton(true);
  -                        else
  -                            wsdl2java.deploySkeleton(false);
  -
  -                    case SERVER_OPT:
  -                        bServer = true;
  -                        wsdl2java.generateServerSide(true);
  -                        break;
  -
  -                    case NAMESPACE_OPT:
  -                        String namespace = option.getArgument(0);
  -                        String packageName = option.getArgument(1);
  -                        namespaceMap.put(namespace, packageName);
  -                        break;
  -
  -                    case NAMESPACE_FILE_OPT:
  -                        wsdl2java.setNStoPkg(option.getArgument());
  -                        break;
  -
  -                    case PACKAGE_OPT:
  -                        bPackageOpt = true;
  -                        wsdl2java.setPackageName(option.getArgument());
  -                        break;
  -
  -                    case OUTPUT_OPT:
  -                        wsdl2java.setOutputDir(option.getArgument());
  -                        break;
  -
  -                    case SCOPE_OPT:
  -                        String scope = option.getArgument();
  -                        if ("Application".equals(scope)) {
  -                            wsdl2java.setScope(Emitter.APPLICATION_SCOPE);
  -                        }
  -                        else if ("Request".equals(scope)) {
  -                            wsdl2java.setScope(Emitter.REQUEST_SCOPE);
  -                        }
  -                        else if ("Session".equals(scope)) {
  -                            wsdl2java.setScope(Emitter.SESSION_SCOPE);
  -                        }
  -                        else {
  -                            System.err.println(
  -                                    JavaUtils.getMessage("badScope00", scope));
  -                        }
  -                        break;
  -
  -                    case TEST_OPT:
  -                        bTestClass = true;
  -                        wsdl2java.generateTestCase(true);
  -                        break;
  -
  -                    case NOIMPORTS_OPT:
  -                        wsdl2java.generateImports(false);
  -                        break;
  -
  -                    case ALL_OPT:
  -                        wsdl2java.generateAll(true);
  -                        break;
  -
  -                    case DEBUG_OPT:
  -                        wsdl2java.debug(true);
  -                        break;
  -
  -                    case TYPEMAPPING_OPT:
  -                        String tmValue = option.getArgument();
  -                        if (tmValue.equals("1.1")) {
  -                            typeMappingVersion = "1.1";
  -                        } else if (tmValue.equals("1.2")) {
  -                            typeMappingVersion = "1.2";
  -                        } else {
  -                            System.out.println(JavaUtils.getMessage("badTypeMappingOption00"));
  -                        }
  -                        break;
  -
  -                    case NETWORK_TIMEOUT_OPT:
  -                        String timeoutValue = option.getArgument();
  -                        long timeout = Long.parseLong(timeoutValue);
  -                        // Convert seconds to milliseconds.
  -                        if(timeout > 0)
  -                            timeout = timeout * 1000;
  -                        wsdl2java.setTimeout(timeout);
  -                        break;
  -                        
  -                    case USERNAME_OPT:
  -                        wsdl2java.setUsername(option.getArgument());
  -                        break;
  -
  -                    case PASSWORD_OPT:
  -                        wsdl2java.setPassword(option.getArgument());
  -                        break;
  -                }
  -            }
  -
  -            // validate argument combinations
  -            //
  -            if (wsdlURI == null) {
  -                printUsage();
  -            }
  -            if (skeletonDeploy != null && !bServer) {
  -                System.out.println(JavaUtils.getMessage("badSkeleton00"));
  -                printUsage();
  -            }
  -            if (!namespaceMap.isEmpty() && bPackageOpt) {
  -                System.out.println(JavaUtils.getMessage("badpackage00"));
  -                printUsage();
  -            }
  -
  -            // set the namespace map if provided
  -            if (!namespaceMap.isEmpty()) {
  -                wsdl2java.setNamespaceMap(namespaceMap);
  -            }
  -
  -            // Set type mapping version
  -            wsdl2java.setTypeMappingVersion(typeMappingVersion);
  -
  -            // Set username and password if provided in URL
  -            wsdl2java.checkForAuthInfo(wsdlURI);
  -
  -            // register a default authenticator to handle proxys
  -            Authenticator.setDefault(
  -                    new DefaultAuthenticator(wsdl2java.getUsername(), 
  -                                             wsdl2java.getPassword()));
  -
  -            // Do the work
  -            wsdl2java.emit(wsdlURI);
  -
  -            // everything is good
  -            System.exit(0);
  -        }
  -        catch (Throwable t) {
  -            t.printStackTrace();
  -            System.exit(1);
  -        }
  -    }
  -
  -    private class WSDLRunnable implements Runnable {
  -        private Emitter emitter;
  -        private String uri;
  -        private boolean done = false;
  -        private Exception failure = null;
  -
  -        public WSDLRunnable(Emitter emitter, String uri) {
  -            this.emitter = emitter;
  -            this.uri = uri;
  -        }
  -
  -        public void run() {
  -            try {
  -                emitter.emit(uri);
  -            } catch (Exception e) {
  -                failure = e;
  -            }
  -            done = true;
  -        }
  -
  -        public boolean isDone() {
  -            return done;
  -        }
  -
  -        public Exception getFailure() {
  -            return failure;
  -        }
  +        wsdl2java.run(args);
       }
   
  -    public void setTypeMappingVersion(String typeMappingVersion) {
  -        if (typeMappingVersion.equals("1.1")) {
  -            writerFactory.setBaseTypeMapping(
  -                    new BaseTypeMapping() {
  -                        final TypeMapping defaultTM = DefaultTypeMappingImpl.getSingleton();
  -                        public String getBaseName(QName qNameIn) {
  -                            javax.xml.rpc.namespace.QName qName =
  -                                new javax.xml.rpc.namespace.QName(
  -                                  qNameIn.getNamespaceURI(),
  -                                  qNameIn.getLocalPart());
  -                            Class cls = defaultTM.getClassForQName(qName);
  -                            if (cls == null)
  -                                return null;
  -                            else
  -                                return JavaUtils.getTextClassName(cls.getName());
  -                        }
  -                    });
  -        } else {
  -            writerFactory.setBaseTypeMapping(
  -                    new BaseTypeMapping() {
  -                        final TypeMapping defaultTM = DefaultSOAP12TypeMappingImpl.create();
  -                        public String getBaseName(QName qNameIn) {
  -                            javax.xml.rpc.namespace.QName qName =
  -                                new javax.xml.rpc.namespace.QName(
  -                                  qNameIn.getNamespaceURI(),
  -                                  qNameIn.getLocalPart());
  -                            Class cls = defaultTM.getClassForQName(qName);
  -                            if (cls == null)
  -                                return null;
  -                            else
  -                                return JavaUtils.getTextClassName(cls.getName());
  -                        }
  -                    });
  -        }
  -    }
       /**
        * Print usage message and exit
        */
  -    private static void printUsage() {
  +    protected void printUsage() {
           String lSep = System.getProperty("line.separator");
           StringBuffer msg = new StringBuffer();
           msg.append("WSDL2Java " +
  @@ -794,52 +314,4 @@
           System.exit(1);
       }
   
  -    /**
  -     * Extract the username and password info (if any) from a URL
  -     * 
  -     */ 
  -    private void checkForAuthInfo(String uri) {
  -        URL url = null;
  -        try {
  -            url = new URL(uri);
  -        } catch (MalformedURLException e) {
  -            // not going to have userInfo
  -            return;
  -        }
  -        String userInfo = url.getUserInfo();
  -        if (userInfo != null) {
  -            int i = userInfo.indexOf(':');
  -            if (i >= 0) {
  -                setUsername(userInfo.substring(0,i));
  -                setPassword(userInfo.substring(i+1));
  -            } else {
  -                setUsername(userInfo);
  -            }
  -        } 
  -    }
  -
  -    /**
  -     * This class is used by WSDL2Java main() only
  -     * Supports the http.proxyUser and http.proxyPassword properties.
  -     */ 
  -    public static class DefaultAuthenticator extends Authenticator {
  -        private String user;
  -        private String password;
  -        
  -        DefaultAuthenticator(String user, String pass) {
  -            this.user = user;
  -            this.password = pass;
  -        }
  -        protected PasswordAuthentication getPasswordAuthentication() {
  -            // if user and password weren't provided, check the system properties
  -            if (user == null) {
  -                user = System.getProperty("http.proxyUser","");
  -            }
  -            if (password == null) {
  -                password = System.getProperty("http.proxyPassword","");
  -            }
  -            
  -            return new PasswordAuthentication (user, password.toCharArray());
  -        }
  -    }
   }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/gen/Generator.java
  
  Index: Generator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.gen;
  
  import java.io.IOException;
  
  /**
  * This is the interface for all writers.  All writers, very simply, must
  * support a write method.
  *
  * Writer and WriterFactory are part of the Writer framework.  Folks who want
  * to use the emitter to generate stuff from WSDL should do 3 things:
  * 1.  Write implementations of the Writer interface, one each for PortType,
  *     Binding, Service, and Type.  These implementations generate the stuff
  *     for each of these WSDL types.
  * 2.  Write an implementation of the WriterFactory interface that returns
  *     instantiations of these Writer implementations as appropriate.
  * 3.  Implement a class with a main method (like Wsdl2java) that instantiates
  *     an emitter and passes it the WriterFactory implementation
  */
  public interface Generator {
      /**
       * Generate something.
       */
      public void generate() throws IOException;
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/gen/GeneratorFactory.java
  
  Index: GeneratorFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.gen;
  
  import javax.wsdl.Binding;
  import javax.wsdl.Definition;
  import javax.wsdl.Message;
  import javax.wsdl.PortType;
  import javax.wsdl.Service;
  
  import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
  import org.apache.axis.wsdl.symbolTable.SymbolTable;
  import org.apache.axis.wsdl.symbolTable.TypeEntry;
  
  /**
  * Generator and Generatoractory are part of the generator framework.
  * Folks who want to use the emitter to generate stuff from WSDL should
  * do 3 things:
  * 1.  Write implementations of the Generator interface, one each fo
  *     Message, PortType, Binding, Service, and Type.  These
  *     implementations generate the stuff for each of these WSDL types.
  * 2.  Write an implementation of the GeneratorFactory interface that
  *     returns instantiations of these Generator implementations as
  *     appropriate.
  * 3.  Implement a class with a main method (like WSDL2Java) that
  *     instantiates an Emitter and passes it the GeneratorFactory
  *     implementation.
  */
  
  public interface GeneratorFactory {
      /**
       * Allow the Generator extension to make a pass through the
       * symbol table doing any pre-generation logic, like creating
       * the Java names for each object and constructing signature
       * strings.
       */
      public void generatorPass(Definition def, SymbolTable symbolTable);
  
      /**
       * Get a Generator implementation that will generate bindings for the given Message.
       */
      public Generator getGenerator(Message message, SymbolTable symbolTable);
  
      /**
       * Get a Generator implementation that will generate bindings for the given PortType.
       */
      public Generator getGenerator(PortType portType, SymbolTable symbolTable);
  
      /**
       * Get a Generator implementation that will generate bindings for the given Binding.
       */
      public Generator getGenerator(Binding binding, SymbolTable symbolTable);
  
      /**
       * Get a Generator implementation that will generate bindings for the given Service.
       */
      public Generator getGenerator(Service service, SymbolTable symbolTable);
  
      /**
       * Get a Generator implementation that will generate bindings for the given Type.
       */
      public Generator getGenerator(TypeEntry type, SymbolTable symbolTable);
  
      /**
       * Get a Generator implementation that will generate anything that doesn't
       * fit into the scope of any of the other Generators.
       */
      public Generator getGenerator(Definition definition, SymbolTable symbolTable);
  
      /**
       * Get TypeMapping to use for translating
       * QNames to base types
       */
      public void setBaseTypeMapping(BaseTypeMapping btm);
      public BaseTypeMapping getBaseTypeMapping();
     
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/gen/NoopFactory.java
  
  Index: NoopFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.gen;
  
  import javax.wsdl.Binding;
  import javax.wsdl.Definition;
  import javax.wsdl.Message;
  import javax.wsdl.PortType;
  import javax.wsdl.QName;
  import javax.wsdl.Service;
  import javax.wsdl.WSDLException;
  
  import org.apache.axis.encoding.TypeMapping;
  import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
  
  import org.apache.axis.utils.JavaUtils;
  
  import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
  import org.apache.axis.wsdl.symbolTable.SymbolTable;
  import org.apache.axis.wsdl.symbolTable.TypeEntry;
  
  /**
  * This factory returns a bunch of NoopGenerators
  */
  
  public class NoopFactory implements GeneratorFactory {
      public void generatorPass(Definition def, SymbolTable symbolTable) {
      } // generatorPass
  
      public Generator getGenerator(Message message, SymbolTable symbolTable) {
          return new NoopGenerator();
      } // getGenerator
      
      public Generator getGenerator(PortType portType, SymbolTable symbolTable) {
          return new NoopGenerator();
      } // getGenerator
      
      public Generator getGenerator(Binding binding, SymbolTable symbolTable) {
          return new NoopGenerator();
      } // getGenerator
      
      public Generator getGenerator(Service service, SymbolTable symbolTable) {
          return new NoopGenerator();
      } // getGenerator
      
      public Generator getGenerator(TypeEntry type, SymbolTable symbolTable) {
          return new NoopGenerator();
      } // getGenerator
  
      public Generator getGenerator(Definition definition, SymbolTable symbolTable) {
          return new NoopGenerator();
      } // getGenerator
  
      private BaseTypeMapping btm = null;
  
      public void setBaseTypeMapping(BaseTypeMapping btm) {
          this.btm = btm;
      } // setBaseTypeMapping
  
      public BaseTypeMapping getBaseTypeMapping() {
          if (btm == null) {
              btm = new BaseTypeMapping() {
                      TypeMapping defaultTM = DefaultSOAP12TypeMappingImpl.create();
                      public String getBaseName(QName qNameIn) {
                          javax.xml.rpc.namespace.QName qName = 
                              new javax.xml.rpc.namespace.QName(
                                qNameIn.getNamespaceURI(),
                                qNameIn.getLocalPart());
                          Class cls = defaultTM.getClassForQName(qName);
                          if (cls == null) {
                              return null;
                          }
                          else {
                              // RJB NOTE:  Javaism - bad bad bad
                              return JavaUtils.getTextClassName(cls.getName());
                          }
                      }
              };
          }
          return btm;
      } // getBaseTypeMapping
  } // class NoopFactory
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/gen/NoopGenerator.java
  
  Index: NoopGenerator.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.gen;
  
  import java.io.IOException;
  
  /**
  * This generator doesn't do anything.
  */
  public class NoopGenerator implements Generator {
  
      /**
       * Do a whole lot of nothing.
       */
      public void generate() throws IOException {
      } // generate
  
  } // class NoopGenerator
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/gen/Parser.java
  
  Index: Parser.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.gen;
  
  import java.io.IOException;
  
  import java.util.Iterator;
  import java.util.Vector;
  
  import javax.wsdl.Binding;
  import javax.wsdl.Definition;
  import javax.wsdl.WSDLException;
  
  import org.apache.axis.utils.JavaUtils;
  
  import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
  import org.apache.axis.wsdl.symbolTable.BindingEntry;
  import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  import org.apache.axis.wsdl.symbolTable.MessageEntry;
  import org.apache.axis.wsdl.symbolTable.ServiceEntry;
  import org.apache.axis.wsdl.symbolTable.SymbolTable;
  import org.apache.axis.wsdl.symbolTable.SymTabEntry;
  import org.apache.axis.wsdl.symbolTable.Type;
  import org.apache.axis.wsdl.symbolTable.TypeEntry;
  
  import org.w3c.dom.Document;
  
  public class Parser {
  
      protected boolean debug   = false;
      protected boolean imports = true;
      protected boolean verbose = false;
  
      // Username and password for Authentication
      protected String username = null;
      protected String password = null;
      
      private GeneratorFactory genFactory = null;
      private SymbolTable      symbolTable = null;
  
      public boolean debug() {
          return debug;
      } // debug
  
      public void setDebug(boolean debug) {
          this.debug = debug;
      } // setDebug
  
      public boolean visitImports() {
          return imports;
      } // visitImports
  
      public void setImports(boolean imports) {
          this.imports = imports;
      } // setImports
  
      public boolean verbose() {
          return verbose;
      } // verbose
  
      public void setVerbose(boolean verbose) {
          this.verbose = verbose;
      } // setVerbose
  
      public String getUsername() {
          return username;
      } // getUsername
  
      public void setUsername(String username) {
          this.username = username;
      } // setUsername
  
      public String getPassword() {
          return password;
      } // getPassword
  
      public void setPassword(String password) {
          this.password = password;
      } // setPassword
  
      public GeneratorFactory getFactory() {
          return genFactory;
      } // getFactory
  
      public void setFactory(GeneratorFactory factory) {
          this.genFactory = factory;
      } // setFactory
  
      /**
       * Get the symbol table.  The symbol table is null until
       * run is called.
       */
      public SymbolTable getSymbolTable() {
          return symbolTable;
      } // getSymbolTable
  
      /**
       * Return the current definition.  The current definition is
       * null until run is called.
       */ 
      public Definition getCurrentDefinition() {
          return symbolTable == null ? null : symbolTable.getDefinition();
      } // getCurrentDefinition
  
      public void run(String wsdlURI) throws IOException, WSDLException {
          if (getFactory() == null) {
              setFactory(new NoopFactory());
          }
          symbolTable = new SymbolTable(
                  genFactory.getBaseTypeMapping(),
                  imports,
                  verbose,
                  debug);
          symbolTable.populate(wsdlURI, username, password);
          generate(symbolTable);
      } // run
  
      /**
       * Call this method if your WSDL document has already been parsed as an XML DOM document.
       * @param context context This is directory context for the Document.  If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work).  If context is null, then the context becomes the current directory.
       * @param doc doc This is the XML Document containing the WSDL.
       */
      public void run(String context, Document doc) throws IOException, WSDLException {
          if (getFactory() == null) {
              setFactory(new NoopFactory());
          }
          symbolTable = new SymbolTable(
                  genFactory.getBaseTypeMapping(),
                  imports,
                  verbose,
                  debug);
          symbolTable.populate(context, doc);
          generate(symbolTable);
      } // run
  
      private void generate(SymbolTable symbolTable) throws IOException, WSDLException {
          Definition def = symbolTable.getDefinition();
          genFactory.generatorPass(def, symbolTable);
          if (debug()) {
              symbolTable.dump(System.out);
          }
  
          // Generate bindings for types
          generateTypes(symbolTable);
  
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                  Generator gen = null;
                  if (entry instanceof MessageEntry) {
                      gen = genFactory.getGenerator(
                              ((MessageEntry) entry).getMessage(), symbolTable);
                  }
                  else if (entry instanceof PortTypeEntry) {
                      PortTypeEntry pEntry = (PortTypeEntry) entry;
                      // If the portType is undefined, then we're parsing a Definition
                      // that didn't contain a portType, merely a binding that referred
                      // to a non-existent port type.  Don't bother writing it.
                      if (pEntry.getPortType().isUndefined()) {
                          continue;
                      }
                      gen = genFactory.getGenerator(pEntry.getPortType(), symbolTable);
                  }
                  else if (entry instanceof BindingEntry) {
                      BindingEntry bEntry = (BindingEntry)entry;
                      Binding binding = bEntry.getBinding();
  
                      // If the binding is undefined, then we're parsing a Definition
                      // that didn't contain a binding, merely a service that referred
                      // to a non-existent binding.  Don't bother writing it.
                      if (binding.isUndefined()) {
                          continue;
                      }
                      gen = genFactory.getGenerator(binding, symbolTable);
                  }
                  else if (entry instanceof ServiceEntry) {
                      gen = genFactory.getGenerator(
                              ((ServiceEntry) entry).getService(), symbolTable);
                  }
                  if (gen != null) {
                      gen.generate();
                  }
              }
          }
  
          // Output extra stuff (deployment files and faults) 
          // outside of the recursive emit method.
          Generator gen = genFactory.getGenerator(def, symbolTable);
          gen.generate();
      } // generate
  
      /**
       * Generate bindings (classes and class holders) for the complex types.
       * If generating serverside (skeleton) spit out beanmappings
       */
      private void generateTypes(SymbolTable symbolTable) throws IOException {
          Vector types = symbolTable.getTypes();
          for (int i = 0; i < types.size(); ++i) {
              TypeEntry type = (TypeEntry) types.elementAt(i);
  
              // Write out the type if and only if:
              //  - we found its definition (getNode())
              //  - it is referenced 
              //  - it is not a base type
              //  - it is a Type (not an Element)
              // (Note that types that are arrays are passed to getGenerator
              //  because they may require a Holder)
              if (type.getNode() != null && 
                  type instanceof Type &&
                  type.isReferenced() && 
                  type.getBaseType() == null) {
                  Generator gen = genFactory.getGenerator(type, symbolTable);
                  gen.generate();
              }
          }
      } // generateTypes
  
  } // class Parser
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/gen/WSDL2.java
  
  Index: WSDL2.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.gen;
  
  import java.util.List;
  
  import org.apache.axis.utils.CLArgsParser;
  import org.apache.axis.utils.CLOption;
  import org.apache.axis.utils.CLOptionDescriptor;
  import org.apache.axis.utils.CLUtil;
  import org.apache.axis.utils.JavaUtils;
  
  public class WSDL2 {
  
      protected static final int DEBUG_OPT = 'D';
      protected static final int HELP_OPT = 'h';
      protected static final int NOIMPORTS_OPT = 'n';
      protected static final int VERBOSE_OPT = 'v';
  
      protected CLOptionDescriptor[] options = new CLOptionDescriptor[]{
          new CLOptionDescriptor("help",
                  CLOptionDescriptor.ARGUMENT_DISALLOWED,
                  HELP_OPT,
                  JavaUtils.getMessage("optionHelp00")),
          new CLOptionDescriptor("verbose",
                  CLOptionDescriptor.ARGUMENT_DISALLOWED,
                  VERBOSE_OPT,
                  JavaUtils.getMessage("optionVerbose00")),
          new CLOptionDescriptor("noImports",
                  CLOptionDescriptor.ARGUMENT_DISALLOWED,
                  NOIMPORTS_OPT,
                  JavaUtils.getMessage("optionImport00")),
          new CLOptionDescriptor("Debug",
                  CLOptionDescriptor.ARGUMENT_DISALLOWED,
                  DEBUG_OPT,
                  JavaUtils.getMessage("optionDebug00"))
      };
  
      protected String wsdlURI = null;
      protected Parser parser;
  
      public WSDL2 () {
          parser = createParser();
      } // ctor
  
      protected Parser createParser() {
          return new Parser();
      } // createParser
  
      public Parser getParser() {
          return parser;
      } // getParser
  
      protected void addOptions(CLOptionDescriptor[] newOptions) {
          if (newOptions != null && newOptions.length > 0) {
              CLOptionDescriptor[] allOptions = new CLOptionDescriptor[
                     options.length + newOptions.length];
              System.arraycopy(options, 0, allOptions, 0, options.length);
              System.arraycopy(newOptions, 0, allOptions, options.length, newOptions.length);
              options = allOptions;
          }
      } // addOptions
  
      protected void parseOption(CLOption option) {
          switch (option.getId()) {
              case CLOption.TEXT_ARGUMENT:
                  if (wsdlURI != null) {
                      printUsage();
                  }
                  wsdlURI = option.getArgument();
                  break;
  
              case HELP_OPT:
                  printUsage();
                  break;
  
              case NOIMPORTS_OPT:
                  parser.setImports(false);
                  break;
  
              case VERBOSE_OPT:
                  parser.setVerbose(true);
                  break;
  
              case DEBUG_OPT:
                  parser.setDebug(true);
                  break;
          }
      } // parseOption
  
      protected void validateOptions() {
          if (wsdlURI == null) {
              printUsage();
          }
      } // validateOptions
  
      protected void printUsage() {
          String lSep = System.getProperty("line.separator");
          StringBuffer msg = new StringBuffer();
          msg.append(
                  "java WSDL2 [options] WSDL-URI")
                  .append(lSep);
          msg.append(lSep);
          msg.append(CLUtil.describeOptions(options).toString());
          System.out.println(msg.toString());
          System.exit(1);
      } // printUsage
  
      public void run(String[] args) {
          // Parse the arguments
          CLArgsParser argsParser = new CLArgsParser(args, options);
  
          // Print parser errors, if any
          if (null != argsParser.getErrorString()) {
              System.err.println(
                      JavaUtils.getMessage("error01", argsParser.getErrorString()));
              printUsage();
          }
  
          // Get a list of parsed options
          List clOptions = argsParser.getArguments();
          int size = clOptions.size();
  
          try {
              // Parse the options and configure the emitter as appropriate.
              for (int i = 0; i < size; i++) {
                  parseOption((CLOption)clOptions.get(i));
              }
  
              // validate argument combinations
              //
              validateOptions();
  
              parser.run(wsdlURI);
              
              // everything is good
              System.exit(0);
          }
          catch (Throwable t) {
              t.printStackTrace();
              System.exit(1);
          }
      } // run
  
      public static void main(String[] args) {
          WSDL2 wsdl2 = new WSDL2();
          wsdl2.run(args);
      } // main
  } // class WSDL2
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BaseType.java
  
  Index: BaseType.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.wsdl.QName;
  
  /**
   * This Type is for a QName represents a Base Type (i.e. xsd:string represents a java.lang.String) 
   */
  public class BaseType extends Type {
      public BaseType(QName pqName) {
          super(pqName);
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BaseTypeMapping.java
  
  Index: BaseTypeMapping.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation.  For more * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.wsdl.QName;
  
  /**
   * Get the base language name for a qname
   */
  public abstract class BaseTypeMapping  {
      /**
       * If the qname is registered in the target language,
       * return the name of the registered type.
       * @param QName representing a type
       * @return name of the registered type or null if not registered.
       */
       public abstract String getBaseName(QName qName);
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/BindingEntry.java
  
  Index: BindingEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import java.util.HashMap;
  
  import javax.wsdl.Binding;
  import javax.wsdl.Operation;
  
  /**
  * This class represents a WSDL binding.  It encompasses the WSDL4J Binding object so it can
  * reside in the SymbolTable.  It also adds a few bits of information that are a nuisance to get
  * from the WSDL4J Binding object:  binding type, binding style, input/output/fault body types.
  */
  public class BindingEntry extends SymTabEntry {
      // Binding styles
      public static final int STYLE_RPC = 0;
      public static final int STYLE_DOCUMENT = 1;
  
      // Binding types
      public static final int TYPE_SOAP = 0;
      public static final int TYPE_HTTP_GET = 1;
      public static final int TYPE_HTTP_POST = 2;
      public static final int TYPE_UNKNOWN = 3;
  
      // Binding Operation use types
      public static final int USE_ENCODED = 0;
      public static final int USE_LITERAL = 1;
  
      private Binding binding;
      private int     bindingType;
      private int     bindingStyle;
      private boolean hasLiteral;
      private HashMap attributes;
      private HashMap  parameters = new HashMap ();
      
  
      /**
       * Construct a BindingEntry from a WSDL4J Binding object and the additional binding info:
       * binding type, binding style, whether there is any literal binding, and the attributes which
       * contain the input/output/fault body type information.
       */
      public BindingEntry(Binding binding, int bindingType, int bindingStyle,
              boolean hasLiteral, HashMap attributes) {
          super(binding.getQName());
          this.binding = binding;
          this.bindingType = bindingType;
          this.bindingStyle = bindingStyle;
          this.hasLiteral = hasLiteral;
          this.attributes = attributes;
      } // ctor
  
      /**
       * Get the Parameters object for the given operation.
       */
      public Parameters getParameters(Operation operation) {
          return (Parameters) parameters.get(operation);
      } // getParameters
  
      /**
       * Get all of the parameters for all operations.
       */
      public HashMap getParameters() {
          return parameters;
      } // getParameters
  
      /**
       * Set the parameters for all operations
       */ 
      public void setParameters(HashMap parameters) {
          this.parameters = parameters;
      }
  
      /**
       * Get this entry's WSDL4J Binding object.
       */
      public Binding getBinding() {
          return binding;
      } // getBinding
  
      /**
       * Get this entry's binding type.  One of BindingEntry.TYPE_SOAP, BindingEntry.TYPE_HTTP_GET,
       * BindingEntry.TYPE_HTTP_POST.
       */
      public int getBindingType() {
          return bindingType;
      } // getBindingType
  
      /**
       * Get this entry's binding style.  One of BindingEntry.STYLE_RPC, BindingEntry.STYLE_DOCUMENT.
       */
      public int getBindingStyle() {
          return bindingStyle;
      } // getBindingStyle
  
      /**
       * Do any of the message stanzas contain a soap:body which uses literal?
       */
      public boolean hasLiteral() {
          return hasLiteral;
      } // hasLiteral
  
      /**
       * Get the input body type for the given operation.  One of BindingEntry.USE_ENCODED,
       * BindingEntry.USE_LITERAL.
       */
      public int getInputBodyType(Operation operation) {
          OperationAttr attr = (OperationAttr) attributes.get(operation);
          if (attr == null) {
              return USE_ENCODED; // should really create an exception for this.
          }
          else {
              return attr.getInputBodyType();
          }
      } // getInputBodyType
  
      /**
       * Get the output body type for the given operation.  One of BindingEntry.USE_ENCODED,
       * BindingEntry.USE_LITERAL.
       */
      public int getOutputBodyType(Operation operation) {
          OperationAttr attr = (OperationAttr) attributes.get(operation);
          if (attr == null) {
              return USE_ENCODED; // should really create an exception for this.
          }
          else {
              return attr.getOutputBodyType();
          }
      } // getOutputBodyType
  
      /**
       * Get the fault body type for the given fault of the given operation.  One of
       * BindingEntry.USE_ENCODED, BindingEntry.USE_LITERAL.
       */
      public int getFaultBodyType(Operation operation, String faultName) {
          OperationAttr attr = (OperationAttr) attributes.get(operation);
          if (attr == null) {
              return 0; // should really create an exception for this.
          }
          else {
              HashMap m = attr.getFaultBodyTypeMap();
  
              // Default to encoded if we didn't have a soap:body for the fault
              if ( ! m.containsKey(faultName) ) {
                  return USE_ENCODED;
              }
  
              return ((Integer) m.get(faultName)).intValue();
          }
      }
  
      /**
       * Contains attributes for Operations
       *  - Body type: encoded or literal
       */
      protected static class OperationAttr {
          private int inputBodyType;
          private int outputBodyType;
          private HashMap faultBodyTypeMap;
  
          public OperationAttr(int inputBodyType, int outputBodyType, HashMap faultBodyTypeMap) {
              this.inputBodyType = inputBodyType;
              this.outputBodyType = outputBodyType;
              this.faultBodyTypeMap = faultBodyTypeMap;
          }
  
          public int getInputBodyType() {
              return inputBodyType;
          }
  
          public int getOutputBodyType() {
              return outputBodyType;
          }
  
          public HashMap getFaultBodyTypeMap() {
              return faultBodyTypeMap;
          }
      } // class OperationAttr
  
  } // class BindingEntry
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/CollectionType.java
  
  Index: CollectionType.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  
  import org.w3c.dom.Node;
  
  import javax.wsdl.QName;
  /**
   * This Type is for a QName that is a 'collection'.
   * For example,
   *   <element name="foo" type="bar" maxOccurs="unbounded" />
   * We need a way to indicate in the symbol table that a foo is
   * 'collection of bars',  In such cases a collection type is 
   * added with the special QName  <name>[<minOccurs>, <maxOccurs>]
   */
  public class CollectionType extends DefinedType {
      public CollectionType(QName pqName, TypeEntry refType, Node pNode, String dims) {
          super(pqName, refType, pNode, dims);
      }
  };
  
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/DefinedElement.java
  
  Index: DefinedElement.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  
  import org.w3c.dom.Node;
  
  import javax.wsdl.QName;
  
  /**
   * This Type is for a QName that is an element, these types are only emitted if 
   * referenced by a ref= or an element=.
   * An element type can be defined inline or it can be defined via
   * a ref/type attribute.
   */
  public class DefinedElement extends Element {
      /**
       * Create an element type defined by a ref/type attribute
       */
      public DefinedElement(QName pqName, TypeEntry refType, Node pNode, String dims) {
          super(pqName, refType, pNode, dims);
      };
      /**
       * Create an element type defined directly.               
       */
      public DefinedElement(QName pqName, Node pNode) {
          super(pqName, pNode);
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/DefinedType.java
  
  Index: DefinedType.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import org.w3c.dom.Node;
  
  import javax.wsdl.QName;
  /**
   * This Type is for a QName that is a complex or simple type, these types are 
   * always emitted.
   */
  public class DefinedType extends Type {
      public DefinedType(QName pqName, Node pNode) {
          super(pqName, pNode);
      }
      public DefinedType(QName pqName, TypeEntry refType, Node pNode, String dims) {
          super(pqName, refType, pNode, dims);
      }
  };
  
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Element.java
  
  Index: Element.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  
  import org.w3c.dom.Node;
  
  import javax.wsdl.QName;
  
  /**
   * This class represents a TypeEntry that is a type (complexType, simpleType, etc.
   *
   * @author Rich Scheuerle  (scheu@us.ibm.com)
   */
  public abstract class Element extends TypeEntry {
  
      /**
       * Create an Element object for an xml construct that references a type that has 
       * not been defined yet.  Defer processing until refType is known.
       */ 
      protected Element(QName pqName, TypeEntry refType, Node pNode, String dims) {
          super(pqName, refType, pNode, dims);
      }
         
      /**
       * Create a Element object for an xml construct that is not a base java type
       */  
      protected Element(QName pqName, Node pNode) {
          super(pqName, pNode);
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/ElementDecl.java
  
  Index: ElementDecl.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.xml.rpc.namespace.QName;
  
  /**
   * Simple utility struct for holding element declarations.
   * 
   * This simply correlates a QName to a TypeEntry.
   * 
   * @author Glen Daniels (gdaniels@apache.org)
   * @author Tom Jordahl (tomj@apache.org)
   */
  public class ElementDecl {
      private QName name;
      private TypeEntry type;
      // The following property is set if minOccurs=0.
      // An item that is not set and has minOccurs=0 
      // should not be passed over the wire.  This
      // is slightly different than nillable=true which
      // causes nil=true to be passed over the wire.
      private boolean minOccursIs0=false;   
  
      public ElementDecl() {
      }
  
      public ElementDecl(TypeEntry type, QName name) {
          this.type = type;
          this.name = name;
      }
  
      public TypeEntry getType() {
          return type;
      }
  
      public void setType(TypeEntry type) {
          this.type = type;
      }
  
      public QName getName() {
          return name;
      }
  
      public void setName(QName name) {
          this.name = name;
      }
  
      public boolean getMinOccursIs0() {
          return minOccursIs0;
      }
  
      public void setMinOccursIs0(boolean minOccursIs0) {
          this.minOccursIs0 = minOccursIs0;
      }
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/MessageEntry.java
  
  Index: MessageEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.wsdl.Message;
  
  /**
  * This class represents a WSDL message.  It simply encompasses the WSDL4J Message object so it can
  * reside in the SymbolTable.
  */
  public class MessageEntry extends SymTabEntry {
      private Message message;
  
      /**
       * Construct a MessageEntry from a WSDL4J Message object.
       */
      public MessageEntry(Message message) {
          super(message.getQName());
          this.message = message;
      } // ctor
  
      /**
       * Get this entry's Message object.
       */
      public Message getMessage() {
          return message;
      } // getMessage
  } // class MessageEntry
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Parameter.java
  
  Index: Parameter.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.wsdl.QName;
  
  /**
    * This class simply collects
    */
  public class Parameter {
  
      // constant values for the parameter mode.
      public static final byte IN = 1;
      public static final byte OUT = 2;
      public static final byte INOUT = 3;
  
      // The QName of the element associated with this param.  Defaults to
      // null, which means it'll be new QName("", name)
      private QName qname;
      
      // The part name of this parameter, just a string.
      private String name;
      
      private TypeEntry type;
      private byte mode = IN;
  
      public String toString() {
          return "(" + type + ", " + getName() + ", "
                  + (mode == IN ? "IN)" : mode == INOUT ? "INOUT)" : "OUT)");
      } // toString
  
      public QName getQName() {
          return qname;
      }
  
      public String getName() {
          if (name == null && qname != null) {
              return qname.getLocalPart();
          }
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
          if (qname == null)
              this.qname = new QName("", name);
      }
  
      public void setQName(QName qname) {
          this.qname = qname;
      }
  
      public TypeEntry getType() {
          return type;
      }
  
      public void setType(TypeEntry type) {
          this.type = type;
      }
  
      public byte getMode() {
          return mode;
      }
  
      public void setMode(byte mode) {
          this.mode = mode;
      }
  } // class Parameter
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Parameters.java
  
  Index: Parameters.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.util.Map;
  import java.util.Vector;
  
  import javax.xml.rpc.namespace.QName;
  
  /**
   * This class simply collects all the parameter or message data for an operation into one place.
   */
  public class Parameters {
  
      // This vector contains instances of the Parameter class
      public Vector list = new Vector();
  
      // The type of the first output part, used as the method's return value
      public TypeEntry returnType = null;
  
      // The name of the return type (from the part name of the output message.
      // Used to create the RPCParam for the return value.
      public QName returnName = null;
  
      // A map of the faults
      public Map faults = null;
  
      // The signature that the interface and the stub will use
      public String signature = null;
  
      // The numbers of the respective parameters
      public int inputs = 0;
      public int inouts = 0;
      public int outputs = 0;
  
      public String toString() {
          return "\nreturnType = " + returnType
                  + "\nreturnName = " + returnName
                  + "\nfaults = " + faults
                  + "\nsignature = " + signature
                  + "\n(inputs, inouts, outputs) = (" + inputs + ", " + inouts + ", " + outputs + ")"
                  + "\nlist = " + list;
      } // toString
  } // class Parameters
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/PortTypeEntry.java
  
  Index: PortTypeEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.wsdl.PortType;
  
  /**
  * This class represents a WSDL portType.  It encompasses the WSDL4J PortType object so it can
  * reside in the SymbolTable.  It also adds the parameter information, which is missing from the
  * WSDL4J PortType object.
  */
  public class PortTypeEntry extends SymTabEntry {
      private PortType portType;
  
      /**
       * Construct a PortTypeEntry from a WSDL4J PortType object and a HashMap of Parameters objects,
       * keyed off of the operation name.
       */
      public PortTypeEntry(PortType portType) {
          super(portType.getQName());
          this.portType = portType;
      } // ctor
  
      /**
       * Get this entry's PortType object.
       */
      public PortType getPortType() {
          return portType;
      } // getPortType
  } // class PortTypeEntry
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.util.Vector;
  
  import javax.wsdl.QName;
  
  import javax.xml.rpc.holders.BooleanHolder;
  import javax.xml.rpc.holders.IntHolder;
  
  import org.apache.axis.Constants;
  
  import org.w3c.dom.Node;
  import org.w3c.dom.NodeList;
  
  /**
   * This class contains static utility methods specifically for schema type queries.
   *
   * @author Rich Scheuerle  (scheu@us.ibm.com)
   */
  public class SchemaUtils {
  
      /**
       * If the specified node represents a supported JAX-RPC complexType or 
       * simpleType, a Vector is returned which contains ElementDecls for the 
       * child element names. 
       * If the element is a simpleType, an ElementDecls is built representing
       * the restricted type with the special name "value".
       * If the element is a complexType which has simpleContent, an ElementDecl
       * is built representing the extended type with the special name "value".
       * This method does not return attribute names and types
       * (use the getContainedAttributeTypes)
       * If the specified node is not a supported 
       * JAX-RPC complexType/simpleType/element null is returned.
       */
      public static Vector getContainedElementDeclarations(Node node, SymbolTable symbolTable) {
          if (node == null) {
              return null;
          }
  
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node complexNode = null;
              for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                  QName complexKind = Utils.getNodeQName(children.item(j));
                  if (complexKind != null &&
                      complexKind.getLocalPart().equals("complexType") &&
                      Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                      complexNode = children.item(j);
                      node = complexNode;
                  }
              }
          }
  
          // Expecting a schema complexType or simpleType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("complexType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the complexType there could be complexContent/simpleContent
              // and extension elements if this is a derived type.  Skip over these.
              NodeList children = node.getChildNodes();
              Node complexContent = null;
              Node simpleContent = null;
              Node extension = null;
              for (int j = 0; j < children.getLength() && complexContent == null; j++) {
                  QName complexContentKind = Utils.getNodeQName(children.item(j));
                  if (complexContentKind != null &&
                      Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
                      if (complexContentKind.getLocalPart().equals("complexContent") )
                          complexContent = children.item(j);
                      else if (complexContentKind.getLocalPart().equals("simpleContent"))
                          simpleContent = children.item(j);
                  }
              }
              if (complexContent != null) {
                  children = complexContent.getChildNodes();
                  for (int j = 0; j < children.getLength() && extension == null; j++) {
                      QName extensionKind = Utils.getNodeQName(children.item(j));
                      if (extensionKind != null &&
                          extensionKind.getLocalPart().equals("extension") &&
                          Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
                          extension = children.item(j);
                  }
              }
              if (simpleContent != null) {
                  children = simpleContent.getChildNodes();
                  for (int j = 0; j < children.getLength() && extension == null; j++) {
                      QName extensionKind = Utils.getNodeQName(children.item(j));
                      if (extensionKind != null &&
                          extensionKind.getLocalPart().equals("extension") &&
                          Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
                          
                          // get the type of the extension
                          QName extendsType =
                                  Utils.getNodeTypeRefQName(children.item(j), 
                                                            "base");
                          
                          // Return an element declaration with a fixed name
                          // ("value") and the correct type.                        
                          Vector v = new Vector();
                          ElementDecl elem = new ElementDecl();
                          elem.setType(symbolTable.getTypeEntry(extendsType, false));
                          elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
                          v.add(elem);
                          return v;
                      }
                          
                  }
              }
  
              if (extension != null) {
                  node = extension;  // Skip over complexContent and extension
              }
  
              // Under the complexType there may be choice, sequence, group and/or all nodes.      
              // (There may be other #text nodes, which we will ignore).
              children = node.getChildNodes();
              Vector v = new Vector();
              for (int j = 0; j < children.getLength(); j++) {
                  QName subNodeKind = Utils.getNodeQName(children.item(j));
                  if (subNodeKind != null &&
                      Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
                      if (subNodeKind.getLocalPart().equals("sequence")) {
                          v.addAll(processSequenceNode(children.item(j), symbolTable));
                      } else if (subNodeKind.getLocalPart().equals("all")) {
                          v.addAll(processAllNode(children.item(j), symbolTable));
                      } else if (subNodeKind.getLocalPart().equals("choice")) {
                          v.addAll(processChoiceNode(children.item(j), symbolTable));
                      } else if (subNodeKind.getLocalPart().equals("group")) {
                          v.addAll(processGroupNode(children.item(j), symbolTable));
                      }
                  }
              }
              return v;
          } else {
              // This may be a simpleType, return the type with the name "value"
              QName simpleQName = getSimpleTypeBase(node, symbolTable);
              if (simpleQName != null) {
                  TypeEntry simpleType = symbolTable.getType(simpleQName);
                  if (simpleType != null) {
                      Vector v = new Vector();
                      ElementDecl elem = new ElementDecl();
                      elem.setType(simpleType);
                      elem.setName(new javax.xml.rpc.namespace.QName("", "value"));
                      v.add(elem);
                      return v;
                  }
              }
          }
          return null;
      }
  
      /**
       * Invoked by getContainedElementDeclarations to get the child element types
       * and child element names underneath a Choice Node
       */
      private static Vector processChoiceNode(Node choiceNode, 
                                              SymbolTable symbolTable) {
          Vector v = new Vector();
          NodeList children = choiceNode.getChildNodes();
          for (int j = 0; j < children.getLength(); j++) {
              QName subNodeKind = Utils.getNodeQName(children.item(j));
              if (subNodeKind != null &&
                  Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
                  if (subNodeKind.getLocalPart().equals("choice")) {
                      v.addAll(processChoiceNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("sequence")) {
                      v.addAll(processSequenceNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("group")) {
                      v.addAll(processGroupNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("element")) {
                      ElementDecl elem = 
                              processChildElementNode(children.item(j), 
                                                      symbolTable);
                      if (elem != null)
                          v.add(elem);
                  }
              }
          }
          return v;
      }
  
      /**
       * Invoked by getContainedElementDeclarations to get the child element types
       * and child element names underneath a Sequence Node
       */
      private static Vector processSequenceNode(Node sequenceNode, 
                                                SymbolTable symbolTable) {
          Vector v = new Vector();
          NodeList children = sequenceNode.getChildNodes();
          for (int j = 0; j < children.getLength(); j++) {
              QName subNodeKind = Utils.getNodeQName(children.item(j));
              if (subNodeKind != null &&
                  Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
                  if (subNodeKind.getLocalPart().equals("choice")) {
                      v.addAll(processChoiceNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("sequence")) {
                      v.addAll(processSequenceNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("group")) {
                      v.addAll(processGroupNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("any")) {
                      TypeEntry type = new DefinedType(Utils.getWSDLQName(Constants.XSD_ANYTYPE), sequenceNode);
                      type.setName("java.lang.Object");
                      ElementDecl elem = new ElementDecl(type, Utils.getAxisQName(new QName("","any")));
                      v.add(elem);
                  } else if (subNodeKind.getLocalPart().equals("element")) {
                      ElementDecl elem = 
                              processChildElementNode(children.item(j), 
                                                      symbolTable);
                      if (elem != null)
                          v.add(elem);
                  }
              }
          }
          return v;
      }
  
      /**
       * Invoked by getContainedElementDeclarations to get the child element types
       * and child element names underneath a group node.
       * (Currently the code only supports a defined group it does not
       * support a group that references a previously defined group)
       */
      private static Vector processGroupNode(Node groupNode, SymbolTable symbolTable) {
          Vector v = new Vector();
          NodeList children = groupNode.getChildNodes();
          for (int j = 0; j < children.getLength(); j++) {
              QName subNodeKind = Utils.getNodeQName(children.item(j));
              if (subNodeKind != null &&
                  Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
                  if (subNodeKind.getLocalPart().equals("choice")) {
                      v.addAll(processChoiceNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("sequence")) {
                      v.addAll(processSequenceNode(children.item(j), symbolTable));
                  } else if (subNodeKind.getLocalPart().equals("all")) {
                      v.addAll(processAllNode(children.item(j), symbolTable));
                  }
              }
          }
          return v;
      }
  
      /**
       * Invoked by getContainedElementDeclarations to get the child element types
       * and child element names underneath an all node.
       */
      private static Vector processAllNode(Node allNode, SymbolTable symbolTable) {
          Vector v = new Vector();
          NodeList children = allNode.getChildNodes();
          for (int j = 0; j < children.getLength(); j++) {
              QName subNodeKind = Utils.getNodeQName(children.item(j));
              if (subNodeKind != null &&
                  Constants.isSchemaXSD(subNodeKind.getNamespaceURI())) {
                  if (subNodeKind.getLocalPart().equals("element")) {
                      ElementDecl elem = 
                              processChildElementNode(children.item(j), 
                                                      symbolTable);
                      if (elem != null)
                          v.add(elem);
                  }
              }
          }
          return v;
      }
  
  
      /**
       * Invoked by getContainedElementDeclarations to get the child element type
       * and child element name for a child element node.
       *
       * If the specified node represents a supported JAX-RPC child element,
       * we return an ElementDecl containing the child element name and type.
       */
      private static ElementDecl processChildElementNode(Node elementNode, 
                                                    SymbolTable symbolTable) {
          // Get the name and type qnames.
          // The type qname is used to locate the TypeEntry, which is then
          // used to retrieve the proper java name of the type.
          QName nodeName = Utils.getNodeNameQName(elementNode);
          BooleanHolder forElement = new BooleanHolder();
          QName nodeType = Utils.getNodeTypeRefQName(elementNode, forElement);
  
  
          // An element inside a complex type is either qualified or unqualified.
          // If the ref= attribute is used, the name of the ref'd element is used
          // (which must be a root element).  If the ref= attribute is not
          // used, the name of the element is unqualified.
  
          if (!forElement.value) {
              // check the Form (or elementFormDefault) attribute of this node to
              // determine if it should be namespace quailfied or not.
              String form = Utils.getAttribute(elementNode, "form");
              if (form != null && form.equals("unqualified")) {
                  // Unqualified nodeName
                  nodeName = new QName("", nodeName.getLocalPart());            
              } else if (form == null) {
                  // check elementForDefault on schema element
                  String def = Utils.getScopedAttribute(elementNode, 
                                                        "elementFormDefault");
                  if (def == null || def.equals("unqualified")) {
                      // Unqualified nodeName
                      nodeName = new QName("", nodeName.getLocalPart());            
                  }
              }
          } else {
              nodeName = nodeType;
          }
          if (nodeType == null) {
              nodeType = getElementAnonQName(elementNode);            
              forElement.value = false;
          }
  
          
          TypeEntry type = (TypeEntry)symbolTable.getTypeEntry(nodeType, 
                                                               forElement.value);
          if (type != null) {
              ElementDecl elem = new ElementDecl(type ,Utils.getAxisQName(nodeName));
              String minOccurs = Utils.getAttribute(elementNode, "minOccurs");
              if (minOccurs != null && minOccurs.equals("0")) {
                  elem.setMinOccursIs0(true);
              }
              return elem;
          }
          
          return null;
      }
  
      /**
       * Returns the WSDL2Java QName for the anonymous type of the element
       * or null.
       */
      public static QName getElementAnonQName(Node node) {
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              for (int j = 0; j < children.getLength(); j++) {
                  QName kind = Utils.getNodeQName(children.item(j));
                  if (kind != null &&
                      (kind.getLocalPart().equals("complexType") ||
                       kind.getLocalPart().equals("simpleType")) &&
                      Constants.isSchemaXSD(kind.getNamespaceURI())) {
                      return Utils.getNodeNameQName(children.item(j));
                  }
              }
          }
          return null;
      }
  
      /**
       * If the specified node is a simple type or contains simpleContent, return true
       */
      public static boolean isSimpleTypeOrSimpleContent(Node node) {
          if (node == null) {
              return false;
          }
  
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node complexNode = null;
              for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                  QName kind = Utils.getNodeQName(children.item(j));
                  if (kind != null &&
                      kind.getLocalPart().equals("complexType") &&
                      Constants.isSchemaXSD(kind.getNamespaceURI())) {
                      complexNode = children.item(j);
                      node = complexNode;
                  }
                  if (kind != null &&
                      kind.getLocalPart().equals("simpleType") &&
                      Constants.isSchemaXSD(kind.getNamespaceURI())) {
                      return true;
                  }
              }
          }
  
          // Expecting a schema complexType or simpleType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("simpleType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              return true;
          }
  
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("complexType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the complexType there could be complexContent/simpleContent
              // and extension elements if this is a derived type.  Skip over these.
              NodeList children = node.getChildNodes();
              Node complexContent = null;
              Node simpleContent = null;
              Node extension = null;
              for (int j = 0; j < children.getLength() && complexContent == null; j++) {
                  QName complexContentKind = Utils.getNodeQName(children.item(j));
                  if (complexContentKind != null &&
                      Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
                      if (complexContentKind.getLocalPart().equals("complexContent") )
                          complexContent = children.item(j);
                      else if (complexContentKind.getLocalPart().equals("simpleContent"))
                          simpleContent = children.item(j);
                  }
              }
              if (complexContent != null) {
                  return false;
              }
              if (simpleContent != null) {
                  return true;
              }
          }
          return false;
      }
  
      /**
       * If the specified node represents a supported JAX-RPC complexType/element
       * which extends another complexType.  The Type of the base is returned.
       */
      public static TypeEntry getComplexElementExtensionBase(Node node, SymbolTable symbolTable) {
          if (node == null) {
              return null;
          }
  
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node complexNode = null;
              for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                  QName complexKind = Utils.getNodeQName(children.item(j));
                  if (complexKind != null &&
                      complexKind.getLocalPart().equals("complexType") &&
                      Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                      complexNode = children.item(j);
                      node = complexNode;
                  }
              }
          }
  
          // Expecting a schema complexType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("complexType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the complexType there could be should be a complexContent &
              // extension elements if this is a derived type. 
              NodeList children = node.getChildNodes();
              Node content = null;
              Node extension = null;
              for (int j = 0; j < children.getLength() && content == null; j++) {
                  QName contentKind = Utils.getNodeQName(children.item(j));
                  if (contentKind != null &&
                      contentKind.getLocalPart().equals("complexContent") &&
                      Constants.isSchemaXSD(contentKind.getNamespaceURI()))
                      content = children.item(j);
                  if (contentKind != null &&
                      contentKind.getLocalPart().equals("simpleContent") &&
                      Constants.isSchemaXSD(contentKind.getNamespaceURI()))
                      content = children.item(j);
              }
              if (content != null) {
                  children = content.getChildNodes();
                  for (int j = 0; j < children.getLength() && extension == null; j++) {
                      QName extensionKind = Utils.getNodeQName(children.item(j));
                      if (extensionKind != null &&
                          extensionKind.getLocalPart().equals("extension") &&
                          Constants.isSchemaXSD(extensionKind.getNamespaceURI()))
                          extension = children.item(j);
                  }
              }
              if (extension == null) {
                  return null;  // No extension                               
              }
  
              // Get the QName of the extension base
              QName extendsType = Utils.getNodeTypeRefQName(extension, "base");
              if (extendsType == null) {
                  return null; // No extension base
              }
              // Return associated Type
              return (TypeEntry) symbolTable.getType(extendsType);
          }
          return null;
      }
  
      /**
       * If the specified node represents a 'normal' non-enumeration simpleType,
       * the QName of the simpleType base is returned.
       */
      public static QName getSimpleTypeBase(Node node, SymbolTable symbolTable) {
          QName baseQName = null;
  
          if (node == null) {
              return null;
          }
  
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node simpleNode = null;
              for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
                  QName simpleKind = Utils.getNodeQName(children.item(j));
                  if (simpleKind != null &&
                      simpleKind.getLocalPart().equals("simpleType") &&
                      Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
                      simpleNode = children.item(j);
                      node = simpleNode;
                  }
              }
          }
          // Get the node kind, expecting a schema simpleType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("simpleType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the simpleType there should be a restriction.
              // (There may be other #text nodes, which we will ignore).
              NodeList children = node.getChildNodes();
              Node restrictionNode = null;
              for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                  QName restrictionKind = Utils.getNodeQName(children.item(j));
                  if (restrictionKind != null &&
                      restrictionKind.getLocalPart().equals("restriction") &&
                      Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
                      restrictionNode = children.item(j);
              }
  
              // The restriction node indicates the type being restricted
              // (the base attribute contains this type).
              
              if (restrictionNode != null) {
                  baseQName = Utils.getNodeTypeRefQName(restrictionNode, "base");
              }
              
              // Look for enumeration elements underneath the restriction node
              if (baseQName != null && restrictionNode != null) {
                  NodeList enums = restrictionNode.getChildNodes();
                  for (int i=0; i < enums.getLength(); i++) {
                      QName enumKind = Utils.getNodeQName(enums.item(i));
                      if (enumKind != null &&
                          enumKind.getLocalPart().equals("enumeration") &&
                          Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
                          
                          // Found an enumeration, this isn't a 
                          // 'normal' simple type.
                          return null;
                      }
                  }
              }
          }
          return baseQName;
      }
  
      /**
       * Returns the contained restriction or extension node underneath
       * the specified node.  Returns null if not found
       */
      public static Node getRestrictionOrExtensionNode(Node node) {
          Node re = null;
          if (node == null) {
              return re;
          }
  
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node node2 = null;
              for (int j = 0; j < children.getLength() && node2 == null; j++) {
                  QName kind2 = Utils.getNodeQName(children.item(j));
                  if (kind2 != null &&
                      (kind2.getLocalPart().equals("simpleType") ||
                       kind2.getLocalPart().equals("complexType") ||
                       kind2.getLocalPart().equals("simpleContent")) &&
                      Constants.isSchemaXSD(kind2.getNamespaceURI())) {
                      node2 = children.item(j);
                      node = node2;
                  }
              }
          }
          // Get the node kind, expecting a schema simpleType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              (nodeKind.getLocalPart().equals("simpleType") ||
               nodeKind.getLocalPart().equals("complexType")) &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the complexType there could be a complexContent.
              NodeList children = node.getChildNodes();
              Node complexContent = null;
              Node extension = null;
              if (nodeKind.getLocalPart().equals("complexType")) {
                  for (int j = 0; j < children.getLength() && complexContent == null; j++) {
                      QName complexContentKind = Utils.getNodeQName(children.item(j));
                      if (complexContentKind != null &&
                          (complexContentKind.getLocalPart().equals("complexContent") ||
                           complexContentKind.getLocalPart().equals("simpleContent"))&&
                          Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
                          complexContent = children.item(j);
                  }
                  node = complexContent;
              }
              // Now get the extension or restriction node
              if (node != null) {
                  children = node.getChildNodes();
                  for (int j = 0; j < children.getLength() && re == null; j++) {
                      QName reKind = Utils.getNodeQName(children.item(j));
                      if (reKind != null &&
                          (reKind.getLocalPart().equals("extension") ||
                           reKind.getLocalPart().equals("restriction")) &&
                          Constants.isSchemaXSD(reKind.getNamespaceURI()))
                          re = children.item(j);
                  }
              }
          }
              
          return re;
      }
  
      /**
       * If the specified node represents an array encoding of one of the following
       * forms, then return the qname repesenting the element type of the array.
       * @param node is the node
       * @param dims is the output value that contains the number of dimensions if return is not null
       * @return QName or null
       */
      public static QName getArrayElementQName(Node node, IntHolder dims) {
          dims.value = 1;  // assume 1 dimension
          QName qName = getCollectionElementQName(node);
          if (qName == null) {
              qName = getArrayElementQName_JAXRPC(node, dims);
          }
          return qName;
      }
  
      /**
       * If the specified node represents an element that refernces a collection
       * then return the qname repesenting the element type of the collection.
       *
       *  <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
       *
       */
      private static QName getCollectionElementQName(Node node) {
          if (node == null) {
              return null;
          }
  
          // If the node kind is an element, dive get its type.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Get the qName of just the type.
              // The compare it against the full type of the node, which
              // takes into account maxOccurs and could return a collection type.
              // If different, return just the type (which is the collection element type).
              QName justTypeQName = Utils.getNodeTypeRefQName(node, "type");
              if (justTypeQName != null) {
                  QName fullTypeQName = Utils.getNodeTypeRefQName(node, new BooleanHolder());
                  if (justTypeQName != fullTypeQName)
                      return justTypeQName;
              }
          }
          return null;
      }
  
      /**
       * If the specified node represents an array encoding of one of the following
       * forms, then return the qname repesenting the element type of the array.
       *
       * @param node is the node
       * @param dims is the output value that contains the number of dimensions if return is not null
       * @return QName or null
       *
       * JAX-RPC Style 2:
       *<xsd:complexType name="hobbyArray">
       *  <xsd:complexContent>
       *    <xsd:restriction base="soapenc:Array">
       *      <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
       *    </xsd:restriction>
       *  </xsd:complexContent>
       *</xsd:complexType>
       *
       * JAX-RPC Style 3:
       *<xsd:complexType name="petArray">
       *  <xsd:complexContent>
       *    <xsd:restriction base="soapenc:Array">
       *      <xsd:sequence>
       *        <xsd:element name="alias" type="xsd:string" maxOccurs="unbounded"/>
       *      </xsd:sequence>
       *    </xsd:restriction>
       *  </xsd:complexContent>
       *</xsd:complexType>
       *
       */
      private static QName getArrayElementQName_JAXRPC(Node node, IntHolder dims) {
          dims.value = 0;  // Assume 0
          if (node == null) {
              return null;
          }
  
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node complexNode = null;
              for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                  QName complexKind = Utils.getNodeQName(children.item(j));
                  if (complexKind != null &&
                      complexKind.getLocalPart().equals("complexType") &&
                      Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                      complexNode = children.item(j);
                      node = complexNode;
                  }
              }
          }
          // Get the node kind, expecting a schema complexType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("complexType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the complexType there should be a complexContent.
              // (There may be other #text nodes, which we will ignore).
              NodeList children = node.getChildNodes();
              Node complexContentNode = null;
              for (int j = 0; j < children.getLength() && complexContentNode == null; j++) {
                  QName complexContentKind = Utils.getNodeQName(children.item(j));
                  if (complexContentKind != null &&
                      (complexContentKind.getLocalPart().equals("complexContent") ||
                      complexContentKind.getLocalPart().equals("simpleContent")) &&
                      Constants.isSchemaXSD(complexContentKind.getNamespaceURI()))
                      complexContentNode = children.item(j);
              }
  
              // Under the complexContent there should be a restriction.
              // (There may be other #text nodes, which we will ignore).
              Node restrictionNode = null;
              if (complexContentNode != null) {
                  children = complexContentNode.getChildNodes();
                  for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
                      QName restrictionKind = Utils.getNodeQName(children.item(j));
                      if (restrictionKind != null &&
                          restrictionKind.getLocalPart().equals("restriction") &&
                          Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
                          restrictionNode = children.item(j);
                  }
              }
  
              // The restriction node must have a base of soapenc:Array.  
              QName baseType = null;
              if (restrictionNode != null) {
                  baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
                  if (baseType != null &&
                      baseType.getLocalPart().equals("Array") &&
                      Constants.isSOAP_ENC(baseType.getNamespaceURI()))
                      ; // Okay
                  else
                      baseType = null;  // Did not find base=soapenc:Array
              }
  
              
              // Under the restriction there should be an attribute OR a sequence/all group node.
              // (There may be other #text nodes, which we will ignore).
              Node groupNode = null;
              Node attributeNode = null;
              if (baseType != null) {
                  children = restrictionNode.getChildNodes();
                  for (int j = 0;
                       j < children.getLength() && groupNode == null && attributeNode == null;
                       j++) {
                      QName kind = Utils.getNodeQName(children.item(j));
                      if (kind != null &&
                          (kind.getLocalPart().equals("sequence") ||
                           kind.getLocalPart().equals("all")) &&
                          Constants.isSchemaXSD(kind.getNamespaceURI())) {
                          groupNode = children.item(j);
                      }
                      if (kind != null &&
                          kind.getLocalPart().equals("attribute") &&
                          Constants.isSchemaXSD(kind.getNamespaceURI())) {
                          // If the attribute node does not have ref="soapenc:arrayType"
                          // then keep looking.
                          QName refQName = Utils.getNodeTypeRefQName(children.item(j), "ref");
                          if (refQName != null &&
                              refQName.getLocalPart().equals("arrayType") &&
                              Constants.isSOAP_ENC(refQName.getNamespaceURI())) {
                              attributeNode = children.item(j);
                          }
                      }
                  }
              }
  
              // If there is an attribute node, look at wsdl:arrayType to get the element type
              if (attributeNode != null) {
                  String wsdlArrayTypeValue = null;
                  Vector attrs = Utils.getAttributesWithLocalName(attributeNode, "arrayType");
                  for (int i=0; i < attrs.size() && wsdlArrayTypeValue == null; i++) {
                      Node attrNode = (Node) attrs.elementAt(i);
                      String attrName = attrNode.getNodeName();
                      QName attrQName = Utils.getQNameFromPrefixedName(attributeNode, attrName);
                      if (Constants.isWSDL(attrQName.getNamespaceURI())) {
                          wsdlArrayTypeValue = attrNode.getNodeValue();
                      }
                  }
  
                  // The value could have any number of [] or [,] on the end
                  // Strip these off to get the prefixed name.
                  // The convert the prefixed name into a qname.
                  // Count the number of [ and , to get the dim information.
                  if (wsdlArrayTypeValue != null) {
                      int i = wsdlArrayTypeValue.indexOf('[');
                      if (i > 0) {
                          String prefixedName = wsdlArrayTypeValue.substring(0,i);
                          String mangledString = wsdlArrayTypeValue.replace(',', '[');
                          dims.value = 0;
                          int index = mangledString.indexOf('[');
                          while (index > 0) {
                              dims.value++;
                              index = mangledString.indexOf('[',index+1);
                          }
                          
                          return Utils.getQNameFromPrefixedName(restrictionNode, prefixedName);
                      }
                  }
              } else if (groupNode != null) {
  
                  // Get the first element node under the group node.       
                  NodeList elements = groupNode.getChildNodes();
                  Node elementNode = null;
                  for (int i=0; i < elements.getLength() && elementNode == null; i++) {
                      QName elementKind = Utils.getNodeQName(elements.item(i));
                      if (elementKind != null &&
                          elementKind.getLocalPart().equals("element") &&
                          Constants.isSchemaXSD(elementKind.getNamespaceURI())) {
                          elementNode = elements.item(i);
                      }
                  }
                   
                  // The element node should have maxOccurs="unbounded" and
                  // a type
                  if (elementNode != null) {
                      String maxOccursValue = Utils.getAttribute(elementNode, "maxOccurs");
                      if (maxOccursValue != null &&
                          maxOccursValue.equalsIgnoreCase("unbounded")) {
                          // Get the QName of just the type
                          dims.value = 1;
                          return Utils.getNodeTypeRefQName(elementNode, "type");
                      }
                  }
              }
              
          }
          return null;
      }
  
      /**
       * Return the attribute names and types if any in the node
       * The even indices are the element types (TypeEntry) and
       * the odd indices are the corresponding names (Strings).
       * 
       * Example:
       * <complexType name="Person">
       *   <sequence>
       *     <element minOccurs="1" maxOccurs="1" name="Age" type="double" />
       *     <element minOccurs="1" maxOccurs="1" name="ID" type="xsd:float" />
       *   </sequence>
       *   <attribute name="Name" type="string" />
       *   <attribute name="Male" type="boolean" />
       * </complexType>
       * 
       */ 
      public static Vector getContainedAttributeTypes(Node node, 
                                                      SymbolTable symbolTable) 
      {
          Vector v = null;    // return value
          
          if (node == null) {
              return null;
          }
          // Check for SimpleContent
          // If the node kind is an element, dive into it.
          QName nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("element") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
              NodeList children = node.getChildNodes();
              Node complexNode = null;
              for (int j = 0; j < children.getLength() && complexNode == null; j++) {
                  QName complexKind = Utils.getNodeQName(children.item(j));
                  if (complexKind != null &&
                      complexKind.getLocalPart().equals("complexType") &&
                      Constants.isSchemaXSD(complexKind.getNamespaceURI())) {
                      complexNode = children.item(j);
                      node = complexNode;
                  }
              }
          }
  
          // Expecting a schema complexType
          nodeKind = Utils.getNodeQName(node);
          if (nodeKind != null &&
              nodeKind.getLocalPart().equals("complexType") &&
              Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  
              // Under the complexType there could be complexContent/simpleContent
              // and extension elements if this is a derived type.  Skip over these.
              NodeList children = node.getChildNodes();
              Node content = null;
              Node extension = null;
              for (int j = 0; j < children.getLength() && content == null; j++) {
                  QName complexContentKind = Utils.getNodeQName(children.item(j));
                  if (complexContentKind != null &&
                      Constants.isSchemaXSD(complexContentKind.getNamespaceURI())) {
                      if (complexContentKind.getLocalPart().equals("complexContent") ||
                          complexContentKind.getLocalPart().equals("simpleContent")) {
                          content = children.item(j);
                      }
                  }
              }
              // Check for extensions
              if (content != null) {
                  children = content.getChildNodes();
                  for (int j = 0; j < children.getLength(); j++) {
                      QName extensionKind = Utils.getNodeQName(children.item(j));
                      if (extensionKind != null &&
                              extensionKind.getLocalPart().equals("extension") &&
                              Constants.isSchemaXSD(extensionKind.getNamespaceURI())) {
                          extension = children.item(j);
                          break;
                      }
                  }
              }
              
              if (extension != null) {
                  node = extension;
              }
              
              // examine children of the node for <attribute> elements
              children = node.getChildNodes();
              for (int i = 0; i < children.getLength(); i++) {
                  Node child = children.item(i);
                  nodeKind = Utils.getNodeQName(child);
                  if (nodeKind == null ||
                          ! nodeKind.getLocalPart().equals("attribute"))
                      continue;
                  
                  // we have an attribute node
                  if (v == null)
                      v = new Vector();
                  
                  // type
                  QName typeAttr = Utils.getNodeTypeRefQName(child, "type");
                  TypeEntry type = symbolTable.getTypeEntry(typeAttr, false);
                  // name
                  QName name = Utils.getNodeNameQName(child);
                  // add type and name to vector, skip it if we couldn't parse it
                  // XXX - this may need to be revisited.
                  if (type != null && name != null) {
                      v.add(type);
                      v.add(name.getLocalPart());
                  }
              }
          }            
          return v;
      }
  
  }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/ServiceEntry.java
  
  Index: ServiceEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import javax.wsdl.Service;
  
  /**
  * This class represents a WSDL service.  It simply encompasses the WSDL4J Service object so it can
  * reside in the SymbolTable.
  */
  public class ServiceEntry extends SymTabEntry {
      private Service service;
  
      /**
       * Construct a ServiceEntry from a WSDL4J Service object.
       */
      public ServiceEntry(Service service) {
          super(service.getQName());
          this.service = service;
      } // ctor
  
      /**
       * Get this entry's Service object.
       */
      public Service getService() {
          return service;
      } // getService
  } // class ServiceEntry
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymTabEntry.java
  
  Index: SymTabEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  
  import javax.wsdl.QName;
  
  /**
  * SymTabEntry is the base class for all symbol table entries.  It contains four things:
  * - a QName
  * - space for a Writer-specific name (for example, in Wsdl2java, this will be the Java name)
  * - isReferenced flag indicating whether this entry is referenced by other entries
  * - dynamicVars; a mechanism for Writers to add additional context information onto entries.
  */
  public abstract class SymTabEntry {
      // The QName of this entry is immutable.  There is no setter for  it.
      protected QName qname;
  
      // The name is Writer implementation dependent.  For example, in Wsdl2java, this will become
      // the Java name.
      protected String name;
  
      // Is this entry referenced by any other entry?
      private boolean isReferenced = false;
  
      private HashMap dynamicVars = new HashMap();
  
      /**
       * Construct a symbol table entry with the given QName.
       */
      protected SymTabEntry(QName qname) {
          this.qname = qname;
      } // ctor
  
      /**
       * Get the QName of this entry.
       */
      public final QName getQName() {
          return qname;
      } // getQName
  
      /**
       * Get the name of this entry.  The name is Writer-implementation-dependent.  For example, in
       * Wsdl2java, this will become the Java name.
       */
      public String getName() {
          return name;
      } // getName
  
      /**
       * Set the name of this entry.  This method is not called by the framework, it is only called
       * by the Writer implementation.
       */
      public void setName(String name) {
          this.name = name;
      } // setName
  
      /**
       * Is this entry referenced by any other entry in the symbol table?
       */
      public final boolean isReferenced() {
          return isReferenced;
      } // isReferenced
  
      /**
       * Set the isReferenced variable, default value is true.
       */
      public final void setIsReferenced(boolean isReferenced) {
          this.isReferenced = isReferenced;
      } // setIsReferenced
  
      /**
       * There may be information that does not exist in WSDL4J/DOM 
       * structures and does not exist in
       * our additional structures, but that Writer implementation 
       * will need.  This information is
       * most likely context-relative, so the DynamicVar map is 
       * provided for the Writers to store and
       * retrieve their particular information.
       */
      public Object getDynamicVar(Object key) {
          return dynamicVars.get(key);
      } // getDynamicVar
  
      public void setDynamicVar(Object key, Object value) {
          dynamicVars.put(key, value);
      } // setDynamicVar
  
      /**
       * Collate the info in this object in string form.
       */
      public String toString() {
          return toString("");
      } // toString
      /**
       * Collate the info in this object in string form with indentation.
       */
      protected String toString(String indent) {
          String string =
              indent + "QName:         " + qname + '\n' + 
              indent + "name:          " + name + '\n' + 
              indent + "isReferenced?  " + isReferenced + '\n';
          String prefix = indent + "dynamicVars:   ";
          Iterator entries = dynamicVars.entrySet().iterator();
          while (entries.hasNext()) {
              Map.Entry entry = (Map.Entry) entries.next();
              Object key = entry.getKey();
              string += prefix + key + " = " + entry.getValue() + '\n';
              prefix = indent + "               ";
          }
          return string;
      } // toString
  } // abstract class SymTabEntry
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.axis.wsdl.symbolTable;
  
  import java.io.File;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  
  import java.net.MalformedURLException;
  import java.net.URL;
  
  import java.util.Collection;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Vector;
  
  import javax.wsdl.Binding;
  import javax.wsdl.BindingFault;
  import javax.wsdl.BindingOperation;
  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.Output;
  import javax.wsdl.Part;
  import javax.wsdl.Port;
  import javax.wsdl.PortType;
  import javax.wsdl.QName;
  import javax.wsdl.Service;
  import javax.wsdl.WSDLException;
  
  import javax.wsdl.factory.WSDLFactory;
  
  import javax.wsdl.xml.WSDLReader;
  
  import javax.wsdl.extensions.http.HTTPBinding;
  import javax.wsdl.extensions.soap.SOAPBinding;
  import javax.wsdl.extensions.soap.SOAPBody;
  
  import javax.xml.rpc.holders.BooleanHolder;
  import javax.xml.rpc.holders.IntHolder;
  
  import org.apache.axis.Constants;
  
  import org.apache.axis.utils.JavaUtils;
  import org.apache.axis.utils.XMLUtils;
  
  import org.apache.axis.wsdl.gen.Generator;
  
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  import org.w3c.dom.NodeList;
  
  /**
  * This class represents a table of all of the top-level symbols from a set of WSDL Definitions and
  * DOM Documents:  XML types; WSDL messages, portTypes, bindings, and services.
  *
  * This symbolTable contains entries of the form <key, value> where key is of type QName and value is
  * of type Vector.  The Vector's elements are all of the objects that have the given QName.  This is
  * necessary since names aren't unique among the WSDL types.  message, portType, binding, service,
  * could all have the same QName and are differentiated merely by type.  SymbolTable contains
  * type-specific getters to bypass the Vector layer:
  *   public PortTypeEntry getPortTypeEntry(QName name), etc.
  */
  public class SymbolTable {
      // Should the contents of imported files be added to the symbol table?
      private boolean addImports;
  
      // The actual symbol table.  This symbolTable contains entries of the form
      // <key, value> where key is of type QName and value is of type Vector.  The
      // Vector's elements are all of the objects that have the given QName.  This
      // is necessary since names aren't unique among the WSDL types.  message,
      // portType, binding, service, could all have the same QName and are
      // differentiated merely by type.  SymbolTable contains type-specific
      // getters to bypass the Vector layer:
      // public PortTypeEntry getPortTypeEntry(QName name), etc.
  
      private HashMap symbolTable = new HashMap();
  
      // A list of the TypeEntry elements in the symbol table
      private Vector types = new Vector();
  
      private boolean verbose;
  
      private boolean debug = false;
  
      private BaseTypeMapping btm = null;
  
      // should we attempt to treat document/literal WSDL as "rpc-style"
      private boolean wrapped = false;
  
      public static final String ANON_TOKEN = ">";
  
      private Definition def = null;
      private Document   doc = null;
  
      /**
       * Construct a symbol table with the given Namespaces.
       */
      public SymbolTable(BaseTypeMapping btm, boolean addImports,
              boolean verbose, boolean debug) {
          this.btm = btm;
          this.addImports = addImports;
          this.verbose = verbose;
          this.debug = debug;
      } // ctor
  
      /**
       * Get the raw symbol table HashMap.
       */
      public HashMap getHashMap() {
          return symbolTable;
      } // getHashMap
  
      /**
       * Get the list of entries with the given QName.  Since symbols can share QNames, this list is
       * necessary.  This list will not contain any more than one element of any given SymTabEntry.
       */
      public Vector getSymbols(QName qname) {
          return (Vector) symbolTable.get(qname);
      } // get
  
      /**
       * Get the entry with the given QName of the given class.  If it does not exist, return null.
       */
      public SymTabEntry get(QName qname, Class cls) {
          Vector v = (Vector) symbolTable.get(qname);
          if (v == null) {
              return null;
          }
          else {
              for (int i = 0; i < v.size(); ++i) {
                  SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                  if (cls.isInstance(entry)) {
                      return entry;
                  }
              }
              return null;
          }
      } // get
      
  
      /**
       * Get the type entry for the given qname.
       * @param qname
       * @param wantElementType boolean that indicates type or element (for type= or ref=)
       */
      public TypeEntry getTypeEntry(QName qname, boolean wantElementType) {
          if (wantElementType) {
              return getElement(qname);
          } else
              return getType(qname);
      } // getTypeEntry
  
      /**
       * Get the Type TypeEntry with the given QName.  If it doesn't exist, return null.
       */
      public Type getType(QName qname) {
          for (int i = 0; i < types.size(); ++i) {
              TypeEntry type = (TypeEntry) types.get(i);
              if (type.getQName().equals(qname)
                      && (type instanceof Type)) {
                  return (Type) type;
              }
          }
          return null;
      } // getType
  
      /**
       * Get the Element TypeEntry with the given QName.  If it doesn't exist, return null.
       */
      public Element getElement(QName qname) {
          for (int i = 0; i < types.size(); ++i) {
              TypeEntry type = (TypeEntry) types.get(i);
              if (type.getQName().equals(qname) && type instanceof Element) {
                  return (Element) type;
              }
          }
          return null;
      } // getElement
  
      /**
       * Get the MessageEntry with the given QName.  If it doesn't exist, return null.
       */
      public MessageEntry getMessageEntry(QName qname) {
          return (MessageEntry) get(qname, MessageEntry.class);
      } // getMessageEntry
  
      /**
       * Get the PortTypeEntry with the given QName.  If it doesn't exist, return null.
       */
      public PortTypeEntry getPortTypeEntry(QName qname) {
          return (PortTypeEntry) get(qname, PortTypeEntry.class);
      } // getPortTypeEntry
  
      /**
       * Get the BindingEntry with the given QName.  If it doesn't exist, return null.
       */
      public BindingEntry getBindingEntry(QName qname) {
          return (BindingEntry) get(qname, BindingEntry.class);
      } // getBindingEntry
  
      /**
       * Get the ServiceEntry with the given QName.  If it doesn't exist, return null.
       */
      public ServiceEntry getServiceEntry(QName qname) {
          return (ServiceEntry) get(qname, ServiceEntry.class);
      } // getServiceEntry
  
      /**
       * Get the list of all the XML schema types in the symbol table.  In other words, all entries
       * that are instances of TypeEntry.
       */
      public Vector getTypes() {
          return types;
      } // getTypes
  
      public Definition getDefinition() {
          return def;
      } // getDefinition
  
      /**
       * Are we wrapping literal soap body elements.
       */ 
      public boolean isWrapped() {
          return wrapped;
      }
  
      /**
       * Turn on/off element wrapping for literal soap body's.
       */ 
      public void setWrapped(boolean wrapped) {
          this.wrapped = wrapped;
      }
  
      /**
       * Dump the contents of the symbol table.  For debugging purposes only.
       */
      public void dump(java.io.PrintStream out) {
          out.println();
          out.println(JavaUtils.getMessage("symbolTable00"));
          out.println("-----------------------");
          Iterator it = symbolTable.values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  out.println(
                          v.elementAt(i).getClass().getName());
                  out.println(v.elementAt(i));
              }
          }
          out.println("-----------------------");
      } // dump
  
  
      /**
       * Call this method if you have a uri for the WSDL document
       * @param uri wsdlURI the location of the WSDL file.
       */
  
      public void populate(String uri) throws IOException, WSDLException {
          populate(uri, null, null);
      } // populate
  
      public void populate(String uri, String username, String password) throws IOException, WSDLException {
          if (verbose)
              System.out.println(JavaUtils.getMessage("parsing00", uri));
  
          Document doc = XMLUtils.newDocument(uri, username, password);
          if (doc == null) {
              throw new IOException(JavaUtils.getMessage("cantGetDoc00", uri));
          }
          populate(uri, doc);
      } // populate
  
      /**
       * Call this method if your WSDL document has already been parsed as an XML DOM document.
       * @param context context This is directory context for the Document.  If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work).  If context is null, then the context becomes the current directory.
       * @param doc doc This is the XML Document containing the WSDL.
       */
      public void populate(String context, Document doc) throws IOException, WSDLException {
          WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
          reader.setFeature("javax.wsdl.verbose", verbose);
          this.def = reader.readWSDL(context, doc);
          this.doc = doc;
  
          add(context, def, doc);
      } // populate
  
      /**
       * Add the given Definition and Document information to the symbol table (including imported
       * symbols), populating it with SymTabEntries for each of the top-level symbols.  When the
       * symbol table has been populated, iterate through it, setting the isReferenced flag
       * appropriately for each entry.
       */
      private void add(String context, Definition def, Document doc)
              throws IOException {
          URL contextURL = context == null ? null : getURL(null, context);
          populate(contextURL, def, doc, null);
          checkForUndefined();
          populateParameters();
          setReferences(def, doc);  // uses wrapped flag set in populateParameters
      } // add
  
      /**
       * Scan the Definition for undefined objects and throw an error.
       */ 
      private void checkForUndefined(Definition def, String filename) throws IOException {
          if (def != null) {
              // Bindings
              Iterator ib = def.getBindings().values().iterator();
              while (ib.hasNext()) {
                  Binding binding = (Binding) ib.next();
                  if (binding.isUndefined()) {
                      if (filename == null) {
                          throw new IOException(
                              JavaUtils.getMessage("emitFailtUndefinedBinding01",
                                      binding.getQName().getLocalPart()));
                      }
                      else {
                          throw new IOException(
                              JavaUtils.getMessage("emitFailtUndefinedBinding02",
                                      binding.getQName().getLocalPart(), filename));
                      }
                  }
              }
  
              // portTypes
              Iterator ip = def.getPortTypes().values().iterator();
              while (ip.hasNext()) {
                  PortType portType = (PortType) ip.next();
                  if (portType.isUndefined()) {
                      if (filename == null) {
                          throw new IOException(
                              JavaUtils.getMessage("emitFailtUndefinedPort01",
                                      portType.getQName().getLocalPart()));
                      }
                      else {
                          throw new IOException(
                              JavaUtils.getMessage("emitFailtUndefinedPort02",
                                      portType.getQName().getLocalPart(), filename));
                      }
                  }
              }
              
  /* tomj: This is a bad idea, faults seem to be undefined
  // RJB reply:  this MUST be done for those systems that do something with
  // messages.  Perhaps we have to do an extra step for faults?  I'll leave
  // this commented for now, until someone uses this generator for something
  // other than WSDL2Java.
              // Messages
              Iterator i = def.getMessages().values().iterator();
              while (i.hasNext()) {
                  Message message = (Message) i.next();
                  if (message.isUndefined()) {
                      throw new IOException(
                              JavaUtils.getMessage("emitFailtUndefinedMessage01",
                                      message.getQName().getLocalPart()));
                  }
              }
  */
          }
      }
  
      /**
       * Scan the symbol table for undefined types and throw an exception.
       */
      private void checkForUndefined() throws IOException {
          Iterator it = symbolTable.values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  if (v.get(i) instanceof Undefined) {
                      throw new IOException(
                              JavaUtils.getMessage("undefined00",
                              "" + ((TypeEntry)v.get(i)).getQName()));
                  }
              }
          }
      } // checkForUndefined
  
      /**
       * Add the given Definition and Document information to the symbol table (including imported
       * symbols), populating it with SymTabEntries for each of the top-level symbols.
       * NOTE:  filename is used only by checkForUndefined so that it can report which WSDL file
       * has the problem.  If we're on the primary WSDL file, then we don't know the name and
       * filename will be null.  But we know the names of all imported files.
       */
      private HashSet importedFiles = new HashSet();
      private void populate(URL context, Definition def, Document doc,
              String filename) throws IOException {
          if (doc != null) {
              populateTypes(doc);
  
              if (addImports) {
                  // Add the symbols from any xsd:import'ed documents.
                  lookForImports(context, doc);
              }
          }
          if (def != null) {
              checkForUndefined(def, filename);
              if (addImports) {
                  // Add the symbols from the wsdl:import'ed WSDL documents
                  Map imports = def.getImports();
                  Object[] importKeys = imports.keySet().toArray();
                  for (int i = 0; i < importKeys.length; ++i) {
                      Vector v = (Vector) imports.get(importKeys[i]);
                      for (int j = 0; j < v.size(); ++j) {
                          Import imp = (Import) v.get(j);
                          if (!importedFiles.contains(imp.getLocationURI())) {
                              importedFiles.add(imp.getLocationURI());
                              URL url = getURL(context, imp.getLocationURI());
                              populate(url, imp.getDefinition(),
                                      XMLUtils.newDocument(url.toString()),
                                      url.toString());
                          }
                      }
                  }
              }
              populateMessages(def);
              populatePortTypes(def);
              populateBindings(def);
              populateServices(def);
          }
      } // populate
  
      /**
       * This is essentially a call to "new URL(contextURL, spec)" with extra handling in case spec is
       * a file.
       */
      private static URL getURL(URL contextURL, String spec) throws IOException {
          // See if we have a good URL.
          URL url = null;
          try {
              url = new URL(contextURL, spec);
          }
          catch (MalformedURLException me)
          {
              if (contextURL == null) {
                  url = new URL("file", "", spec);
              } else {
                  // get the parent directory of the contextURL, and append
                  // the spec string to the end.
                  String contextFileName = contextURL.getFile();
                  String parentName = new File(contextFileName).getParent();
                  if (parentName != null) {
                      url = new URL(new URL("file", "", parentName + '/'), spec);
                  }
                  else {
                      throw new FileNotFoundException(url.toString());
                  }
              }
          }
  
          // Everything is OK with this URL, although a file url constructed
          // above may not exist.  This will be caught later when the URL is
          // accessed.
          return url;
      } // getURL
      /**
       * Recursively find all xsd:import'ed objects and call populate for each one.
       */
      private void lookForImports(URL context, Node node) throws IOException {
          NodeList children = node.getChildNodes();
          for (int i = 0; i < children.getLength(); i++) {
              Node child = children.item(i);
              if ("import".equals(child.getLocalName())) {
                  NamedNodeMap attributes = child.getAttributes();
                  Node importFile = attributes.getNamedItem("schemaLocation");
                  if (importFile != null) {
                      String filename = getURL(context,
                              importFile.getNodeValue()).toString();
                      populate(context, null,
                              XMLUtils.newDocument(filename), filename);
                  }
              }
              lookForImports(context, child);
          }
      } // lookForImports
  
      /**
       * Populate the symbol table with all of the Types from the Document.
       */
      private void populateTypes(Document doc) throws IOException {
          addTypes(doc, ABOVE_SCHEMA_LEVEL);
      } // populateTypes
  
      /**
       * Utility method which walks the Document and creates Type objects for
       * each complexType, simpleType, or element referenced or defined.
       *
       * What goes into the symbol table?  In general, only the top-level types (ie., those just below
       * the schema tag).  But base types and references can appear below the top level.  So anything
       * at the top level is added to the symbol table, plus non-Element types (ie, base and refd)
       * that appear deep within other types.
       */
      private static final int ABOVE_SCHEMA_LEVEL = -1;
      private static final int SCHEMA_LEVEL = 0;
      private void addTypes(Node node, int level) throws IOException {
          if (node == null) {
              return;
          }
          // Get the kind of node (complexType, wsdl:part, etc.)
          QName nodeKind = Utils.getNodeQName(node);
  
          if (nodeKind != null) {
              String localPart = nodeKind.getLocalPart();
              boolean isXSD = Constants.isSchemaXSD(nodeKind.getNamespaceURI());
              if ((isXSD && localPart.equals("complexType") ||
                   localPart.equals("simpleType"))) {
  
                  // If an extension or restriction is present,
                  // create a type for the reference
                  Node re = SchemaUtils.getRestrictionOrExtensionNode(node);
                  if (re != null  &&
                      Utils.getAttribute(re, "base") != null) {
                      createTypeFromRef(re);
                  }
  
                  // This is a definition of a complex type.
                  // Create a Type.
                  createTypeFromDef(node, false, false);
              }
              else if (isXSD && localPart.equals("element")) {
                  // If the element has a type/ref attribute, create
                  // a Type representing the referenced type.
                  if (Utils.getNodeTypeRefQName(node, "type") != null ||
                      Utils.getNodeTypeRefQName(node, "ref") != null) {
                      createTypeFromRef(node);
                  }
  
                  // If an extension or restriction is present,
                  // create a type for the reference
                  Node re = SchemaUtils.getRestrictionOrExtensionNode(node);
                  if (re != null  &&
                      Utils.getAttribute(re, "base") != null) {
                      createTypeFromRef(re);
                  }
  
                  // Create a type representing an element.  (This may
                  // seem like overkill, but is necessary to support ref=
                  // and element=.
                  createTypeFromDef(node, true, level > SCHEMA_LEVEL);
              }
              else if (isXSD && localPart.equals("attribute")) {
                  // If the attribute has a type/ref attribute, create
                  // a Type representing the referenced type.
                  if (Utils.getNodeTypeRefQName(node, "type") != null) {
                      createTypeFromRef(node);
                  }
  
                  // Get the symbol table entry and make sure it is a simple 
                  // type
                  QName refQName = Utils.getNodeTypeRefQName(node, "type");
                  if (refQName != null) {
                      TypeEntry refType = getTypeEntry(refQName, false);
                      if (refType != null &&
                          refType instanceof Undefined) {
                          // Don't know what the type is.
                          // It better be simple so set it as simple
                          refType.setSimpleType(true);
                      } else if (refType == null ||
                                 (!(refType instanceof BaseType) &&
                                  !refType.isSimpleType())) {
                          // Problem if not simple
                          throw new IOException(
                                                JavaUtils.getMessage("AttrNotSimpleType01",
                                                                     refQName.toString()));
                      }
                  }
              }
              else if (localPart.equals("part") &&
                       Constants.isWSDL(nodeKind.getNamespaceURI())) {
                  
                  // This is a wsdl part.  Create an TypeEntry representing the reference
                  createTypeFromRef(node);
              }
          }
  
          if (level == ABOVE_SCHEMA_LEVEL) {
              if (nodeKind != null && nodeKind.getLocalPart().equals("schema")) {
                  level = SCHEMA_LEVEL;
              }
          }
          else {
              ++level;
          }
  
          // Recurse through children nodes
          NodeList children = node.getChildNodes();
          for (int i = 0; i < children.getLength(); i++) {
              addTypes(children.item(i), level);
          }
      } // addTypes
  
      /**
       * Create a TypeEntry from the indicated node, which defines a type
       * that represents a complexType, simpleType or element (for ref=).
       */
      private void createTypeFromDef(Node node, boolean isElement,
              boolean belowSchemaLevel) throws IOException {
          // Get the QName of the node's name attribute value
          QName qName = Utils.getNodeNameQName(node);
          if (qName != null) {
  
              // If the qname is already registered as a base type,
              // don't create a defining type/element.
              if (!isElement && btm.getBaseName(qName)!=null) {
                  return;
              }
  
              // If the node has a type or ref attribute, get the 
              // qname representing the type
              BooleanHolder forElement = new BooleanHolder();
              QName refQName = Utils.getNodeTypeRefQName(node, forElement);
  
              if (refQName != null) {
                  // Now get the TypeEntry
                  TypeEntry refType = getTypeEntry(refQName, forElement.value);
  
                  if (!belowSchemaLevel) {
                      symbolTablePut(new DefinedElement(qName, refType, node, ""));
                  }
              }   
              else {
                  // Flow to here indicates no type= or ref= attribute.
                  
                  // See if this is an array or simple type definition.
                  IntHolder numDims = new IntHolder();
                  numDims.value = 0;
                  QName arrayEQName = SchemaUtils.getArrayElementQName(node, numDims);
  
                  if (arrayEQName != null) {
                      // Get the TypeEntry for the array element type
                      refQName = arrayEQName;
                      TypeEntry refType = getTypeEntry(refQName, false);
                      if (refType == null) {
                          // Not defined yet, add one
                          String baseName = btm.getBaseName(refQName);
                          if (baseName != null)
                              refType = new BaseType(refQName);
                          else
                              refType = new UndefinedType(refQName);
                          symbolTablePut(refType);
                      }
  
                      // Create a defined type or element that references refType
                      String dims = "";
                      while (numDims.value > 0) {
                          dims += "[]";
                          numDims.value--;
                      }
  
                      TypeEntry defType = null;
                      if (isElement) {
                          if (!belowSchemaLevel) { 
                              defType = new DefinedElement(qName, refType, node, dims);
                          }
                      } else {
                          defType = new DefinedType(qName, refType, node, dims);
                      }
                      if (defType != null) {
                          symbolTablePut(defType);
                      }
                  }
                  else {
  
                      // Create a TypeEntry representing this  type/element
                      String baseName = btm.getBaseName(qName);
                      if (baseName != null) {
                          symbolTablePut(new BaseType(qName));
                      }
                      else {
  
                          // Create a type entry, set whether it should
                          // be mapped as a simple type, and put it in the 
                          // symbol table.
                          TypeEntry te = null;
                          if (!isElement) {
                              te = new DefinedType(qName, node);
                              
                              // check if we are an anonymous type underneath
                              // an element.  If so, we point the refType of the
                              // element to us (the real type).
                              if (qName.getLocalPart().indexOf(ANON_TOKEN) >= 0 ) {
                                  Node parent = node.getParentNode();
                                  QName parentQName = Utils.getNodeNameQName(parent);
                                  TypeEntry parentType = getElement(parentQName);
                                  if (parentType != null) {
                                      parentType.setRefType(te);
                                  }
                              }
                              
                          } else {
                              if (!belowSchemaLevel) {
                                  te = new DefinedElement(qName, node);
                              }
                          }
                          if (te != null) {
                              if (SchemaUtils.isSimpleTypeOrSimpleContent(node)) {
                                  te.setSimpleType(true);
                              }
                              symbolTablePut(te);
                          }
                      }
                  }
              }
          }
      } // createTypeFromDef
      
      /**
       * Node may contain a reference (via type=, ref=, or element= attributes) to 
       * another type.  Create a Type object representing this referenced type.
       */
      private void createTypeFromRef(Node node) throws IOException {
          // Get the QName of the node's type attribute value
          BooleanHolder forElement = new BooleanHolder();
          QName qName = Utils.getNodeTypeRefQName(node, forElement);
          if (qName != null) {
              
              // Get Type or Element depending on whether type attr was used.
              TypeEntry type = getTypeEntry(qName, forElement.value);
              
              // A symbol table entry is created if the TypeEntry is not found    
              if (type == null) {
                  // See if this is a special QName for collections
                  if (qName.getLocalPart().indexOf("[") > 0) {
                      // Get the TypeEntry for the collection element
                      QName typeAttr = Utils.getNodeTypeRefQName(node, "type");
                      TypeEntry collEl = getTypeEntry(typeAttr, false);
                      if (collEl == null) {
                          // Collection Element Type not defined yet, add one.
                          String baseName = btm.getBaseName(typeAttr);
                          if (baseName != null) {
                              collEl = new BaseType(typeAttr);
                          } else {
                              collEl = new UndefinedType(typeAttr);
                          }
                          symbolTablePut(collEl);
                      }
                      symbolTablePut(new CollectionType(qName, collEl, node, "[]"));
                  } else {
                      // Add a BaseType or Undefined Type/Element
                      String baseName = btm.getBaseName(qName);
                      if (baseName != null)
                          symbolTablePut(new BaseType(qName));
                      else if (forElement.value == false)
                          symbolTablePut(new UndefinedType(qName));
                      else
                          symbolTablePut(new UndefinedElement(qName));
                  }
              }
          }
      } // createTypeFromRef
  
      /**
       * Populate the symbol table with all of the MessageEntry's from the Definition.
       */
      private void populateMessages(Definition def) throws IOException {
          Iterator i = def.getMessages().values().iterator();
          while (i.hasNext()) {
              Message message = (Message) i.next();
              MessageEntry mEntry = new MessageEntry(message);
              symbolTablePut(mEntry);
          }
      } // populateMessages
  
      /**
       * Populate the symbol table with all of the PortTypeEntry's from the Definition.
       */
      private void populatePortTypes(Definition def) throws IOException {
          Iterator i = def.getPortTypes().values().iterator();
          while (i.hasNext()) {
              PortType portType = (PortType) i.next();
  
              // If the portType is undefined, then we're parsing a Definition
              // that didn't contain a portType, merely a binding that referred
              // to a non-existent port type.  Don't bother with it.
              if (!portType.isUndefined()) {
                  PortTypeEntry ptEntry = new PortTypeEntry(portType);
                  symbolTablePut(ptEntry);
              }
          }
      } // populatePortTypes
  
      /**
       * Create the parameters and store them in the bindingEntry.
       */ 
      private void populateParameters() throws IOException {
          Iterator it = symbolTable.values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  if (v.get(i) instanceof BindingEntry) {
                      BindingEntry bEntry = (BindingEntry) v.get(i);
                      
                      Binding binding = bEntry.getBinding();
                      PortType portType = binding.getPortType();
                      
                      HashMap parameters = new HashMap();
                      Iterator operations = portType.getOperations().iterator();
                      
                      // get parameters
                      while(operations.hasNext()) {
                          Operation operation = (Operation) operations.next();
                          String namespace = portType.getQName().getNamespaceURI();
                          Parameters parms = getOperationParameters(operation, 
                                                                    namespace, 
                                                                    bEntry);
                          parameters.put(operation, parms);
                      }
                      bEntry.setParameters(parameters);
                  }
              }
          }
      } // populate Parameters
      
      /**
       * For the given operation, this method returns the parameter info conveniently collated.
       * There is a bit of processing that is needed to write the interface, stub, and skeleton.
       * Rather than do that processing 3 times, it is done once, here, and stored in the
       * Parameters object.
       */
      public Parameters getOperationParameters(Operation operation,
                                                String namespace, 
                                                BindingEntry bindingEntry) throws IOException {
          Parameters parameters = new Parameters();
  
          // The input and output Vectors of Parameters
          Vector inputs = new Vector();
          Vector outputs = new Vector();
  
          List parameterOrder = operation.getParameterOrdering();
  
          // Handle parameterOrder="", which is techinically illegal
          if (parameterOrder != null && parameterOrder.isEmpty()) {
              parameterOrder = null;
          }
  
          // All input parts MUST be in the parameterOrder list.  It is an error otherwise.
          if (parameterOrder != null) {
              Input input = operation.getInput();
              if (input != null) {
                  Message inputMsg = input.getMessage();
                  Map allInputs = inputMsg.getParts();
                  Collection orderedInputs = inputMsg.getOrderedParts(parameterOrder);
                  if (allInputs.size() != orderedInputs.size()) {
                      throw new IOException(JavaUtils.getMessage("emitFail00", operation.getName()));
                  }
              }
          }
  
          boolean literalInput = false;
          boolean literalOutput = false;
          String bindingName = "unknown";
          if (bindingEntry != null) {
              literalInput = (bindingEntry.getInputBodyType(operation) == BindingEntry.USE_LITERAL);
              literalOutput = (bindingEntry.getOutputBodyType(operation) == BindingEntry.USE_LITERAL);
              bindingName = bindingEntry.getBinding().getQName().toString();
          }
          
          // Collect all the input parameters
          Input input = operation.getInput();
          if (input != null) {
              getParametersFromParts(inputs,
                          input.getMessage().getOrderedParts(null), 
                          literalInput, operation.getName(), bindingName);
          }
  
          // Collect all the output parameters
          Output output = operation.getOutput();
          if (output != null) {
              getParametersFromParts(outputs,
                          output.getMessage().getOrderedParts(null), 
                          literalOutput, operation.getName(), bindingName);
          }
  
          if (parameterOrder != null) {
              // Construct a list of the parameters in the parameterOrder list, determining the
              // mode of each parameter and preserving the parameterOrder list.
              for (int i = 0; i < parameterOrder.size(); ++i) {
                  String name = (String) parameterOrder.get(i);
  
                  // index in the inputs Vector of the given name, -1 if it doesn't exist.
                  int index = getPartIndex(name, inputs);
  
                  // index in the outputs Vector of the given name, -1 if it doesn't exist.
                  int outdex = getPartIndex(name, outputs);
  
                  if (index >= 0) {
                      // The mode of this parameter is either in or inout
                      addInishParm(inputs, outputs, index, outdex, parameters, true);
                  }
                  else if (outdex >= 0) {
                      addOutParm(outputs, outdex, parameters, true);
                  }
                  else {
                      System.err.println(JavaUtils.getMessage("noPart00", name));
                  }
              }
          }
  
          // Get the mode info about those parts that aren't in the 
          // parameterOrder list. Since they're not in the parameterOrder list,
          // the order is, first all in (and inout) parameters, then all out
          // parameters, in the order they appear in the messages.
          for (int i = 0; i < inputs.size(); i++) {
              Parameter p = (Parameter)inputs.get(i);
              int outdex = getPartIndex(p.getName(), outputs);
              addInishParm(inputs, outputs, i, outdex, parameters, false);
          }
  
          // Now that the remaining in and inout parameters are collected,
          // determine the status of outputs.  If there is only 1, then it
          // is the return value.  If there are more than 1, then they are 
          // out parameters.
          if (outputs.size() == 1) {
              Parameter returnParam = (Parameter)outputs.get(0);
              parameters.returnType = returnParam.getType();
              if (parameters.returnType instanceof DefinedElement) {
                  parameters.returnName = Utils.getAxisQName( 
                          ((DefinedElement)parameters.returnType).getQName());
              } else {
                  parameters.returnName = 
                          Utils.getAxisQName(returnParam.getQName()); 
              }
              ++parameters.outputs;
          }
          else {
              for (int i = 0; i < outputs.size(); i++) {
                  addOutParm(outputs, i, parameters, false);
              }
          }
          parameters.faults = operation.getFaults();
  
          return parameters;
      } // parameters
  
      /**
       * Return the index of the given name in the given Vector, -1 if it doesn't exist.
       */
      private int getPartIndex(String name, Vector v) {
          for (int i = 0; i < v.size(); i++) {
              if (name.equals(((Parameter)v.get(i)).getName())) {
                  return i;
              }
          }
          return -1;
      } // getPartIndex
  
      /**
       * Add an in or inout parameter to the parameters object.
       */
      private void addInishParm(Vector inputs, 
                                Vector outputs, 
                                int index, 
                                int outdex, 
                                Parameters parameters, 
                                boolean trimInput) {        
          Parameter p = (Parameter)inputs.get(index);
          // If this is an element, we want the XML to reflect the element name
          // not the part name.
          if (p.getType() instanceof DefinedElement) {
              DefinedElement de = (DefinedElement)p.getType();
              p.setQName(de.getQName());
          }
  
          // Should we remove the given parameter type/name entries from the Vector?
          if (trimInput) {
              inputs.remove(index);
          }
  
          // At this point we know the name and type of the parameter, and that it's at least an
          // in parameter.  Now check to see whether it's also in the outputs Vector.  If it is,
          // then it's an inout parameter.
          if (outdex >= 0) {
              Parameter outParam = (Parameter)outputs.get(outdex);
              if (p.getType().equals(outParam.getType())) {
                  outputs.remove(outdex);
                  p.setMode(Parameter.INOUT);
                  ++parameters.inouts;
              } else {
                  // If we're here, we have both an input and an output
                  // part with the same name but different types.... guess
                  // it's not really an inout....
                  ++parameters.inputs;  // Is this OK??
              }
          } else {
              ++parameters.inputs;
          }
          
          parameters.list.add(p);
      } // addInishParm
  
      /**
       * Add an output parameter to the parameters object.
       */
      private void addOutParm(Vector outputs, 
                              int outdex, 
                              Parameters parameters, 
                              boolean trim) {
          Parameter p = (Parameter)outputs.get(outdex);
  
          if (p.getType() instanceof DefinedElement) {
              DefinedElement de = (DefinedElement)p.getType();
              p.setQName(de.getQName());
          }
  
          if (trim) {
              outputs.remove(outdex);
          }
  
          p.setMode(Parameter.OUT);
          ++parameters.outputs;
          parameters.list.add(p);
      } // addOutParm
  
      /**
       * This method returns a vector containing Parameters which represent
       * each Part (shouldn't we call these "Parts" or something?)
       */
      public void getParametersFromParts(Vector v, 
                                            Collection parts, 
                                            boolean literal, 
                                            String opName, 
                                            String bindingName) 
              throws IOException {
          Iterator i = parts.iterator();
  
          while (i.hasNext()) {
              Parameter param = new Parameter();
              Part part = (Part) i.next();
              QName elementName = part.getElementName();
              QName typeName = part.getTypeName();
              String partName = part.getName();
  
              // Hack alert - Try to sense "wrapped" document literal mode
              if (literal && !i.hasNext() && partName.equals("parameters"))
                  wrapped = true;
              
              if (!literal || !wrapped) {
                  // We're either RPC or literal + not wrapped.
                  
                  param.setName(partName);
  
                  // Add this type or element name
                  if (typeName != null) {
                      param.setType(getType(typeName));
                  } else if (elementName != null) {
                      // Just an FYI: The WSDL spec says that for use=encoded
                      // that parts reference an abstract type using the type attr
                      // but we kinda do the right thing here, so let it go.
                      param.setType(getElement(elementName));
                  }
                                  
                  v.add(param);
                  
                  continue;   // next part
              }
              
              // flow to here means literal + wrapped!
                  
              // See if we can map all the XML types to java(?) types
              // if we can, we use these as the types
              Node node = null;
              Element e;
              if (typeName != null) {
                  // Since we can't (yet?) make the Axis engine generate the right
                  // XML for literal parts that specify the type attribute,
                  // abort processing with an error if we encounter this case
                  //
                  // node = getTypeEntry(typeName, false).getNode();
                  throw new IOException(
                          JavaUtils.getMessage("literalTypePart00", 
                                               new String[] {partName, 
                                                             opName,  
                                                             bindingName}));
              }
              
              if (elementName == null) {
                  throw new IOException(
                          JavaUtils.getMessage("noElemOrType", 
                                               partName, 
                                               opName));                
              }
              
              // Get the node which corresponds to the type entry for this
              // element.  i.e.:
              //  <part name="part" element="foo:bar"/>
              //  ...
              //  <schema targetNamespace="foo">
              //    <element name="bar"...>  <--- This one
              node = getTypeEntry(elementName, true).getNode();
              
              // Check if this element is of the form:
              //    <element name="foo" type="tns:foo_type"/> 
              QName type = Utils.getNodeTypeRefQName(node, "type");
              if (type != null) {
                  // If in fact we have such a type, go get the node that
                  // corresponds to THAT definition.
                  node = getTypeEntry(type, false).getNode();
              }
              
              // If we have nothing at this point, we're in trouble.
              if (node == null) {
                  throw new IOException(
                          JavaUtils.getMessage("badTypeNode", 
                                               new String[] {
                                                   partName, 
                                                   opName,  
                                                   elementName.toString()}));                
              }
  
              // Get the nested type entries.
              Vector vTypes =
                      SchemaUtils.getContainedElementDeclarations(node, this);
  
              if (vTypes != null) {
                  // add the elements in this list
                  for (int j = 0; j < vTypes.size(); j++) {
                      ElementDecl elem = (ElementDecl) vTypes.elementAt(j);
                      Parameter p = new Parameter();
                      p.setQName(Utils.getWSDLQName(elem.getName()));
                      p.setType(elem.getType());
                      v.add(p);
                  }
              } else {
                  // XXX - This should be a SOAPElement/SOAPBodyElement
                  Parameter p = new Parameter();
                  p.setName(partName);
                  
                  if (typeName != null) {
                      p.setType(getType(typeName));
                  } else if (elementName != null) {
                      p.setType(getElement(elementName));
                  }
                  
                  v.add(p);
              }
          } // while
          
      } // partStrings
  
      /**
       * Populate the symbol table with all of the BindingEntry's from the Definition.
       */
      private void populateBindings(Definition def) throws IOException {
          Iterator i = def.getBindings().values().iterator();
          while (i.hasNext()) {
              int bindingStyle = BindingEntry.STYLE_DOCUMENT;
              int bindingType = BindingEntry.TYPE_UNKNOWN;
              Binding binding = (Binding) i.next();
              Iterator extensibilityElementsIterator = binding.getExtensibilityElements().iterator();
              while (extensibilityElementsIterator.hasNext()) {
                  Object obj = extensibilityElementsIterator.next();
                  if (obj instanceof SOAPBinding) {
                      bindingType = BindingEntry.TYPE_SOAP;
                      SOAPBinding sb = (SOAPBinding) obj;
                      String style = sb.getStyle();
                      if ("rpc".equalsIgnoreCase(style)) {
                          bindingStyle = BindingEntry.STYLE_RPC;
                      }
                  }
                  else if (obj instanceof HTTPBinding) {
                      HTTPBinding hb = (HTTPBinding) obj;
                      if (hb.getVerb().equalsIgnoreCase("post")) {
                          bindingType = BindingEntry.TYPE_HTTP_POST;
                      }
                      else {
                          bindingType = BindingEntry.TYPE_HTTP_GET;
                      }
                  }
              }
  
              // Check the Binding Operations for use="literal"
              boolean hasLiteral = false;
              HashMap attributes = new HashMap();
              List bindList = binding.getBindingOperations();
              for (Iterator opIterator = bindList.iterator(); opIterator.hasNext();) {
                  int inputBodyType = BindingEntry.USE_ENCODED;
                  int outputBodyType = BindingEntry.USE_ENCODED;
                  BindingOperation bindOp = (BindingOperation) opIterator.next();
  
                  // input
                  if (bindOp.getBindingInput() != null) {
                      if (bindOp.getBindingInput().getExtensibilityElements() != null) {
                          Iterator inIter = bindOp.getBindingInput().getExtensibilityElements().iterator();
                          for (; inIter.hasNext();) {
                              Object obj = inIter.next();
                              if (obj instanceof SOAPBody) {
                                  String use = ((SOAPBody) obj).getUse();
                                  if (use == null) {
                                      throw new IOException(JavaUtils.getMessage(
                                              "noUse", bindOp.getName()));
                                  }
                                  if (use.equalsIgnoreCase("literal")) {
                                      inputBodyType = BindingEntry.USE_LITERAL;
                                  }
                                  break;
                              }
                          }
                      }
                  }
  
                  // output
                  if (bindOp.getBindingOutput() != null) {
                      if (bindOp.getBindingOutput().getExtensibilityElements() != null) {
                          Iterator outIter = bindOp.getBindingOutput().getExtensibilityElements().iterator();
                          for (; outIter.hasNext();) {
                              Object obj = outIter.next();
                              if (obj instanceof SOAPBody) {
                                  String use = ((SOAPBody) obj).getUse();
                                  if (use == null) {
                                      throw new IOException(JavaUtils.getMessage(
                                              "noUse", bindOp.getName()));
                                  }
                                  if (use.equalsIgnoreCase("literal")) {
                                      outputBodyType = BindingEntry.USE_LITERAL;
                                  }
                                  break;
                              }
                          }
                      }
                  }
  
                  // faults
                  HashMap faultMap = new HashMap();
                  Iterator faultMapIter = bindOp.getBindingFaults().values().iterator();
                  for (; faultMapIter.hasNext(); ) {
                      BindingFault bFault = (BindingFault)faultMapIter.next();
  
                      // Set default entry for this fault
                      String faultName = bFault.getName();
                      int faultBodyType = BindingEntry.USE_ENCODED;
  
                      Iterator faultIter =
                              bFault.getExtensibilityElements().iterator();
                      for (; faultIter.hasNext();) {
                          Object obj = faultIter.next();
                          if (obj instanceof SOAPBody) {
                              String use = ((SOAPBody) obj).getUse();
                              if (use == null) {
                                  throw new IOException(JavaUtils.getMessage(
                                          "noUse", bindOp.getName()));
                              }
                              if (use.equalsIgnoreCase("literal")) {
                                  faultBodyType = BindingEntry.USE_LITERAL;
                              }
                              break;
                          }
                      }
                      // Add this fault name and bodyType to the map
                      faultMap.put(faultName, new Integer(faultBodyType));
                  }
                  // Associate the portType operation that goes with this binding
                  // with the body types.
                  attributes.put(bindOp.getOperation(),
                          new BindingEntry.OperationAttr(inputBodyType, outputBodyType, faultMap));
  
                  // If the input or output body uses literal, flag the binding as using literal.
                  // NOTE:  should I include faultBodyType in this check?
                  if (inputBodyType == BindingEntry.USE_LITERAL ||
                          outputBodyType == BindingEntry.USE_LITERAL) {
                      hasLiteral = true;
                  }
              } // binding operations
  
              BindingEntry bEntry = new BindingEntry(binding, bindingType, bindingStyle, hasLiteral, attributes);
              symbolTablePut(bEntry);
          }
      } // populateBindings
  
      /**
       * Populate the symbol table with all of the ServiceEntry's from the Definition.
       */
      private void populateServices(Definition def) throws IOException {
          Iterator i = def.getServices().values().iterator();
          while (i.hasNext()) {
              Service service = (Service) i.next();
  
              // do a bit of name validation
              if (service.getQName() == null ||
                  service.getQName().getLocalPart() == null || 
                  service.getQName().getLocalPart().equals("")) {
                  throw new IOException(JavaUtils.getMessage("BadServiceName00"));
              }
              
              ServiceEntry sEntry = new ServiceEntry(service);
              symbolTablePut(sEntry);
          }
      } // populateServices
  
      /**
       * Set each SymTabEntry's isReferenced flag.  The default is false.  If no other symbol
       * references this symbol, then leave it false, otherwise set it to true.
       * (An exception to the rule is that derived types are set as referenced if 
       * their base type is referenced.  This is necessary to support generation and
       * registration of derived types.)
       */
      private void setReferences(Definition def, Document doc) {
          Map stuff = def.getServices();
          if (stuff.isEmpty()) {
              stuff = def.getBindings();
              if (stuff.isEmpty()) {
                  stuff = def.getPortTypes();
                  if (stuff.isEmpty()) {
                      stuff = def.getMessages();
                      if (stuff.isEmpty()) {
                          for (int i = 0; i < types.size(); ++i) {
                              TypeEntry type = (TypeEntry) types.get(i);
                              setTypeReferences(type, doc, false);
                          }
                      }
                      else {
                          Iterator i = stuff.values().iterator();
                          while (i.hasNext()) {
                              Message message = (Message) i.next();
                              MessageEntry mEntry =
                                      getMessageEntry(message.getQName());
                              setMessageReferences(mEntry, def, doc, false);
                          }
                      }
                  }
                  else {
                      Iterator i = stuff.values().iterator();
                      while (i.hasNext()) {
                          PortType portType = (PortType) i.next();
                          PortTypeEntry ptEntry =
                                  getPortTypeEntry(portType.getQName());
                          setPortTypeReferences(ptEntry, null, def, doc);
                      }
                  }
              }
              else {
                  Iterator i = stuff.values().iterator();
                  while (i.hasNext()) {
                      Binding binding = (Binding) i.next();
                      BindingEntry bEntry = getBindingEntry(binding.getQName());
                      setBindingReferences(bEntry, def, doc);
                  }
              }
          }
          else {
              Iterator i = stuff.values().iterator();
              while (i.hasNext()) {
                  Service service = (Service) i.next();
                  ServiceEntry sEntry = getServiceEntry(service.getQName());
                  setServiceReferences(sEntry, def, doc);
              }
          }
      } // setReferences
  
      /**
       * Set the isReferenced flag to true on the given TypeEntry and all
       * SymTabEntries that it refers to.
       */
      private void setTypeReferences(TypeEntry entry, Document doc,
              boolean literal) {
  
          // Check to see if already processed.
          if ((entry.isReferenced() && !literal) ||
              (entry.isOnlyLiteralReferenced() && literal)) {
              return;
          }
  
          if (wrapped) {
              // If this type is ONLY referenced from a literal usage in a binding,
              // then isOnlyLiteralReferenced should return true.
              if (!entry.isReferenced() && literal) {
                  entry.setOnlyLiteralReference(true);
              }
              // If this type was previously only referenced as a literal type,
              // but now it is referenced in a non-literal manner, turn off the
              // onlyLiteralReference flag.
              else if (entry.isOnlyLiteralReferenced() && !literal) {
                  entry.setOnlyLiteralReference(false);
              }
          }
  
  
          // If we don't want to emit stuff from imported files, only set the
          // isReferenced flag if this entry exists in the immediate WSDL file.
          Node node = entry.getNode();
          if (addImports || node == null || node.getOwnerDocument() == doc) {
              entry.setIsReferenced(true);
              if (entry instanceof DefinedElement) {
                  BooleanHolder forElement = new BooleanHolder();
                  QName referentName = Utils.getNodeTypeRefQName(node, forElement);
                  if (referentName != null) {
                      TypeEntry referent = getTypeEntry(referentName, forElement.value);
                      if (referent != null) {
                          setTypeReferences(referent, doc, literal);
                      }
                  }
                  // If the Defined Element has an anonymous type, 
                  // process it with the current literal flag setting.
                  QName anonQName = SchemaUtils.getElementAnonQName(entry.getNode());
                  if (anonQName != null) {
                      TypeEntry anonType = getType(anonQName);
                      if (anonType != null) {
                          setTypeReferences(anonType, doc, literal);
                          return;
                      }
                  }
              }
          }
  
          HashSet nestedTypes = Utils.getNestedTypes(entry, this, true);
          Iterator it = nestedTypes.iterator();
          while (it.hasNext()) {
              TypeEntry nestedType = (TypeEntry) it.next();
              if (!nestedType.isReferenced()) {
                  //setTypeReferences(nestedType, doc, literal);
                  setTypeReferences(nestedType, doc, false);
              }
          }
      } // setTypeReferences
  
      /**
       * Set the isReferenced flag to true on the given MessageEntry and all
       * SymTabEntries that it refers to.
       */
      private void setMessageReferences(
              MessageEntry entry, Definition def, Document doc, boolean literal) {
          // If we don't want to emit stuff from imported files, only set the
          // isReferenced flag if this entry exists in the immediate WSDL file.
          Message message = entry.getMessage();
          if (addImports) {
              entry.setIsReferenced(true);
          }
          else {
              // NOTE:  I thought I could have simply done:
              // if (def.getMessage(message.getQName()) != null)
              // but that method traces through all imported messages.
              Map messages = def.getMessages();
              if (messages.containsValue(message)) {
                  entry.setIsReferenced(true);
              }
          }
  
          // Set all the message's types
          Iterator parts = message.getParts().values().iterator();
          while (parts.hasNext()) {
              Part part = (Part) parts.next();
              TypeEntry type = getType(part.getTypeName());
              if (type != null) {
                  setTypeReferences(type, doc, literal);
              }
              type = getElement(part.getElementName());
              if (type != null) {
                  setTypeReferences(type, doc, literal);
                  //QName ref = Utils.getNodeTypeRefQName(type.getNode(), "type");
                  TypeEntry refType = type.getRefType();
                  if (refType != null) {
                    setTypeReferences(refType, doc, literal);
                  }
              }
          }
      } // setMessageReference
  
      /**
       * Set the isReferenced flag to true on the given PortTypeEntry and all
       * SymTabEntries that it refers to.
       */
      private void setPortTypeReferences(
              PortTypeEntry entry, BindingEntry bEntry,
              Definition def, Document doc) {
          // If we don't want to emit stuff from imported files, only set the
          // isReferenced flag if this entry exists in the immediate WSDL file.
          PortType portType = entry.getPortType();
          if (addImports) {
              entry.setIsReferenced(true);
          }
          else {
              // NOTE:  I thought I could have simply done:
              // if (def.getPortType(portType.getQName()) != null)
              // but that method traces through all imported portTypes.
              Map portTypes = def.getPortTypes();
              if (portTypes.containsValue(portType)) {
                  entry.setIsReferenced(true);
              }
          }
  
          // Set all the portType's messages
          Iterator operations = portType.getOperations().iterator();
  
          // For each operation, query its input, output, and fault messages
          while (operations.hasNext()) {
              Operation operation = (Operation) operations.next();
  
              Input input = operation.getInput();
              Output output = operation.getOutput();
  
              // Find out if this reference is a literal reference or not.
              boolean literalInput = false;
              boolean literalOutput = false;
              if (bEntry != null) {
                  literalInput = bEntry.getInputBodyType(operation) ==
                          BindingEntry.USE_LITERAL;
                  literalOutput = bEntry.getOutputBodyType(operation) ==
                          BindingEntry.USE_LITERAL;
              }
  
              // Query the input message
              if (input != null) {
                  Message message = input.getMessage();
                  if (message != null) {
                      MessageEntry mEntry = getMessageEntry(message.getQName());
                      if (mEntry != null) {
                          setMessageReferences(mEntry, def, doc, literalInput);
                      }
                  }
              }
  
              // Query the output message
              if (output != null) {
                  Message message = output.getMessage();
                  if (message != null) {
                      MessageEntry mEntry = getMessageEntry(message.getQName());
                      if (mEntry != null) {
                          setMessageReferences(mEntry, def, doc, literalOutput);
                      }
                  }
              }
  
              // Query the fault messages
              Iterator faults =
                operation.getFaults().values().iterator();
              while (faults.hasNext()) {
                  Message message = ((Fault) faults.next()).getMessage();
                  if (message != null) {
                      MessageEntry mEntry = getMessageEntry(message.getQName());
                      if (mEntry != null) {
                          setMessageReferences(mEntry, def, doc, false);
                      }
                  }
              }
          }
      } // setPortTypeReferences
  
      /**
       * Set the isReferenced flag to true on the given BindingEntry and all
       * SymTabEntries that it refers to ONLY if this binding is a SOAP binding.
       */
      private void setBindingReferences(
              BindingEntry entry, Definition def, Document doc) {
  
          if (entry.getBindingType() == BindingEntry.TYPE_SOAP) {
              // If we don't want to emit stuff from imported files, only set the
              // isReferenced flag if this entry exists in the immediate WSDL file.
              Binding binding = entry.getBinding();
              if (addImports) {
                  entry.setIsReferenced(true);
              }
              else {
                  // NOTE:  I thought I could have simply done:
                  // if (def.getBindng(binding.getQName()) != null)
                  // but that method traces through all imported bindings.
                  Map bindings = def.getBindings();
                  if (bindings.containsValue(binding)) {
                      entry.setIsReferenced(true);
                  }
              }
  
              // Set all the binding's portTypes
              PortType portType = binding.getPortType();
              PortTypeEntry ptEntry = getPortTypeEntry(portType.getQName());
              if (ptEntry != null) {
                  setPortTypeReferences(ptEntry, entry, def, doc);
              }
          }
      } // setBindingReferences
  
      /**
       * Set the isReferenced flag to true on the given ServiceEntry and all
       * SymTabEntries that it refers to.
       */
      private void setServiceReferences(
              ServiceEntry entry, Definition def, Document doc) {
          // If we don't want to emit stuff from imported files, only set the
          // isReferenced flag if this entry exists in the immediate WSDL file.
          Service service = entry.getService();
          if (addImports) {
              entry.setIsReferenced(true);
          }
          else {
              // NOTE:  I thought I could have simply done:
              // if (def.getService(service.getQName()) != null)
              // but that method traces through all imported services.
              Map services = def.getServices();
              if (services.containsValue(service)) {
                  entry.setIsReferenced(true);
              }
          }
  
          // Set all the service's bindings
          Iterator ports = service.getPorts().values().iterator();
          while (ports.hasNext()) {
              Port port = (Port) ports.next();
              Binding binding = (Binding) port.getBinding();
              BindingEntry bEntry = getBindingEntry(binding.getQName());
              if (bEntry != null) {
                  setBindingReferences(bEntry, def, doc);
              }
          }
      } // setServiceReferences
  
      /**
       * Put the given SymTabEntry into the symbol table, if appropriate.  
       */
      private void symbolTablePut(SymTabEntry entry) throws IOException {
          QName name = entry.getQName();
          if (get(name, entry.getClass()) == null) {
              // An entry of the given qname of the given type doesn't exist yet.
              if (entry instanceof Type && 
                  get(name, UndefinedType.class) != null) {
  
                  // A undefined type exists in the symbol table, which means
                  // that the type is used, but we don't yet have a definition for
                  // the type.  Now we DO have a definition for the type, so
                  // replace the existing undefined type with the real type.
  
                  if (((TypeEntry)get(name, UndefinedType.class)).isSimpleType() &&
                      !((TypeEntry)entry).isSimpleType()) {
                      // Problem if the undefined type was used in a 
                      // simple type context.
                      throw new IOException(
                                            JavaUtils.getMessage("AttrNotSimpleType01",
                                                                 name.toString()));
  
                  }
                  Vector v = (Vector) symbolTable.get(name);
                  for (int i = 0; i < v.size(); ++i) {
                      Object oldEntry = v.elementAt(i);
                      if (oldEntry instanceof UndefinedType) {
  
                          // Replace it in the symbol table
                          v.setElementAt(entry, i);
  
                          // Replace it in the types Vector
                          for (int j = 0; j < types.size(); ++j) {
                              if (types.elementAt(j) == oldEntry) {
                                  types.setElementAt(entry, j);
                              }
                          }
                          
                          // Update all of the entries that refer to the unknown type
                          ((UndefinedType)oldEntry).update((Type)entry);
                      }
                  }
              } else if (entry instanceof Element && 
                  get(name, UndefinedElement.class) != null) {
                  // A undefined element exists in the symbol table, which means
                  // that the element is used, but we don't yet have a definition for
                  // the element.  Now we DO have a definition for the element, so
                  // replace the existing undefined element with the real element.
                  Vector v = (Vector) symbolTable.get(name);
                  for (int i = 0; i < v.size(); ++i) {
                      Object oldEntry = v.elementAt(i);
                      if (oldEntry instanceof UndefinedElement) {
  
                          // Replace it in the symbol table
                          v.setElementAt(entry, i);
  
                          // Replace it in the types Vector
                          for (int j = 0; j < types.size(); ++j) {
                              if (types.elementAt(j) == oldEntry) {
                                  types.setElementAt(entry, j);
                              }
                          }
                          
                          // Update all of the entries that refer to the unknown type
                          ((Undefined)oldEntry).update((Element)entry);
                      }
                  }
              }
              else {
                  // Add this entry to the symbol table
                  Vector v = (Vector) symbolTable.get(name);
                  if (v == null) {
                      v = new Vector();
                      symbolTable.put(name, v);
                  }
                  v.add(entry);
                  if (entry instanceof TypeEntry) {
                      types.add(entry);
                  }
              }
          }
          else {
              throw new IOException(
                      JavaUtils.getMessage("alreadyExists00", "" + name));
          }
      } // symbolTablePut
  
  } // class SymbolTable
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Type.java
  
  Index: Type.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  
  import org.w3c.dom.Node;
  
  import javax.wsdl.QName;
  
  /**
   * This class represents a TypeEntry that is a type (complexType, simpleType, etc.
   *
   * @author Rich Scheuerle  (scheu@us.ibm.com)
   */
  public abstract class Type extends TypeEntry {
  
      /**
       * Create a Type object for an xml construct name that represents a base type
       */
      protected Type(QName pqName) {
          super(pqName);
      }
         
      /**
       * Create a TypeEntry object for an xml construct that references a type that has 
       * not been defined yet.  Defer processing until refType is known.
       */ 
      protected Type(QName pqName, TypeEntry refType, Node pNode, String dims) {
          super(pqName, refType, pNode, dims);
      }
         
      /**
       * Create a Type object for an xml construct that is not a base type
       */  
      protected Type(QName pqName, Node pNode) {
          super(pqName, pNode);
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/TypeEntry.java
  
  Index: TypeEntry.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.io.IOException;
  
  import javax.wsdl.QName;
  
  import org.apache.axis.utils.JavaUtils;
  
  import org.w3c.dom.Node;
  
  /**
   * This class represents a wsdl types entry that is supported by the WSDL2Java emitter.
   * A TypeEntry has a QName representing its XML name and a name, which in the
   * WSDL2Java back end is its full java name.  The TypeEntry may also have a Node,
   * which locates the definition of the emit type in the xml.
   * A TypeEntry object extends SymTabEntry and is built by the SymbolTable class for
   * each supported root complexType, simpleType, and elements that are
   * defined or encountered.
   *
   *                    SymTabEntry
   *                        |
   *                    TypeEntry
   *                  /           \
   *            Type                Element
   *             |                     |
   * (BaseType,                    (DefinedElement,
   *  CollectionType                UndefinedElement)
   *  DefinedType,
   *  UndefinedType)
   *
   *  UndefinedType and UndefinedElement are placeholders when the real type or element
   *  is not encountered yet.  Both of these implement the Undefined interface.
   *  
   *  A TypeEntry whose java (or other language) name depends on an Undefined type, will
   *  have its name initialization deferred until the Undefined type is replaced with
   *  a defined type.  The updateUndefined() method is invoked by the UndefinedDelegate to
   *  update the information.
   *
   *  Each TypeEntry whose language name depends on another TypeEntry will have the refType
   *  field set.  For example:
   *      <element name="foo" type="bar" />
   *  The TypeEntry for "foo" will have a refType set to the TypeEntry of "bar".
   * 
   *  Another Example:
   *     <xsd:complexType name="hobbyArray">
   *       <xsd:complexContent>
   *         <xsd:restriction base="soapenc:Array">
   *           <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
   *         </xsd:restriction>
   *       </xsd:complexContent>
   *     </xsd:complexType>
   *  The TypeEntry for "hobbyArray" will have a refType that locates the TypeEntry for xsd:string
   *  and the dims field will be "[]"
   *
   *
   *
   * @author Rich Scheuerle  (scheu@us.ibm.com)
   */
  public abstract class TypeEntry extends SymTabEntry {
  
      protected Node    node;      // Node
  
      protected TypeEntry refType; // Some TypeEntries refer to other types.
                                   
  
      protected String  dims ="";  // If refType is an element, dims indicates 
                                   // the array dims (for example "[]").
                                
      protected boolean undefined; // If refType is an Undefined type 
                                   // (or has a refType that is Undefined) 
                                   // then the undefined flag is set.
                                   //  The name cannot be determined
                                   // until the Undefined type is found.
      protected boolean isBaseType;// Indicates if represented by a 
                                   // primitive or util class
      protected boolean isSimpleType = false; // Indicates if this type is a simple type
      protected boolean onlyLiteralReference = false; // Indicates
                                   // whether this type is only referenced
                                   // via a binding's literal use.
  
      /**
       * Create a TypeEntry object for an xml construct that references another type. 
       * Defer processing until refType is known.
       */  
      protected TypeEntry(QName pqName, TypeEntry refType, Node pNode, String dims) {
          super(pqName);
          node = pNode;
          this.undefined = refType.undefined;
          this.refType = refType;
          if (dims == null)
              dims = "";
          this.dims = dims;
          
          if (refType.undefined) {
              // Need to defer processing until known.
              TypeEntry uType = refType;
              while (!(uType instanceof Undefined)) {
                  uType = uType.refType;
              }
              ((Undefined)uType).register(this);
          } else {
              isBaseType = (refType.isBaseType && refType.dims.equals("") && dims.equals(""));
          }
          
          //System.out.println(toString());
  
      }
         
      /**
       * Create a TypeEntry object for an xml construct that is not a base type
       */  
      protected TypeEntry(QName pqName, Node pNode) {
          super(pqName);
          node  = pNode;
          refType = null;
          undefined = false;
          dims = "";
          isBaseType = false;
          //System.out.println(toString());
      }
  
      /**
       * Create a TypeEntry object for an xml construct name that represents a base type
       */
      protected TypeEntry(QName pqName) {
          super(pqName);
          node = null;
          undefined = false;
          dims = "";
          isBaseType = true;
          //System.out.println(toString());
      }
         
      /**
       * Query the node for this type.
       */
      public Node getNode() {
          return node;
      }
  
      /**
       * Returns the Base Type Name.
       * For example if the Type represents a schema integer, "int" is returned.
       * If this is a user defined type, null is returned.
       */
      public String getBaseType() {
          if (isBaseType) {
              return name;
          }
          else {
              return null;
          }
      }
  
      public boolean isSimpleType() {
          return isSimpleType;
      }
  
      public void setSimpleType(boolean simpleType) {
          isSimpleType = simpleType;
      }
  
      /**
       * Is this type references ONLY as a literal type?  If a binding's
       * message's soapBody says:  use="literal", then a type is referenced
       * literally.  Note that that type's contained types (ie., an address
       * contains a phone#) are not referenced literally.  Since a type
       * that is ONLY referenced as a literal may cause a generator to act
       * differently (like WSDL2Java), this extra reference distinction is
       * needed.
       */
      public boolean isOnlyLiteralReferenced() {
          return onlyLiteralReference;
      } // isOnlyLiteralReferenced
  
      /**
       * Set the isOnlyLiteralReference flag.
       */
      public void setOnlyLiteralReference(boolean set) {
          onlyLiteralReference = set;
      } // setOnlyLiteralRefeerence
  
      /**
       * getUndefinedTypeRef returns the Undefined TypeEntry that this entry depends on or NULL.
       */
      protected TypeEntry getUndefinedTypeRef() {
          if (this instanceof Undefined) 
              return this;
          if (undefined && refType != null) {
              if (refType.undefined) {
                  TypeEntry uType = refType;
                  while (!(uType instanceof Undefined)) {
                      uType = uType.refType;
                  }
                  return uType;
              }
          }
          return null;
      }
  
      /**
       * UpdateUndefined is called when the ref TypeEntry is finally known.
       * @param oldRef The TypeEntry representing the Undefined TypeEntry
       * @param newRef The replacement TypeEntry
       * @return true if TypeEntry is changed in any way.
       */
      protected boolean updateUndefined(TypeEntry oldRef, TypeEntry newRef) throws IOException {
          boolean changedState = false;
          // Replace refType with the new one if applicable
          if (refType == oldRef) {
              refType = newRef;
              changedState = true;
              // Detect a loop
              TypeEntry te = refType;
              while(te != null && te != this) {
                  te = te.refType;
              }
              if (te == this) {
                  // Detected a loop.
                  undefined = false;
                  isBaseType = false;
                  node = null;                   
                  throw new IOException(JavaUtils.getMessage("undefinedloop00", getQName().toString()));
              }
          }
  
          // Update information if refType is now defined
          if (refType != null && undefined && refType.undefined==false) {
              undefined = false;
              changedState = true;
              isBaseType = (refType.isBaseType && refType.dims.equals("") && dims.equals(""));
          }
          return changedState;
      }
  
  
      /**
       * If this type references another type, return that type, otherwise return null.
       */
      public TypeEntry getRefType() {
          return refType;
      } // getRefType
  
      public void setRefType(TypeEntry refType) {
          this.refType = refType;
      }
  
      /**
       * Return the dimensions of this type, which can be 0 or more "[]".
       */
      public String getDimensions() {
          return dims;
      } // getDimensions
  
      /**
       * Get string representation.
       */
      public String toString() {
          return toString("");
      }
  
      /**
       * Get string representation with indentation
       */
      protected String toString(String indent) {
          String refString = indent + "RefType:       null \n";
          if (refType != null)
              refString = indent + "RefType:\n" + refType.toString(indent + "  ") + "\n";
          return super.toString(indent) + 
              indent + "Class:         " + this.getClass().getName() + "\n" + 
              indent + "Base?:         " + isBaseType + "\n" + 
              indent + "Undefined?:    " + undefined + "\n" + 
              indent + "isSimpleType?  " + isSimpleType + "\n" +
              indent + "Node:          " + getNode() + "\n" +
              indent + "Dims:          " + dims + "\n" +
              refString;
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Undefined.java
  
  Index: Undefined.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.io.IOException;
  
  /**
   * This Undefined interface is implemented by UndefinedType and UndefinedElement.
   */
  public interface Undefined {
      /**
       *  Register referrant TypeEntry so that 
       *  the code can update the TypeEntry when the Undefined Element or Type is defined
       */
      public void register(TypeEntry referrant);
  
      /**
       *  Call update with the actual TypeEntry.  This updates all of the
       *  referrant TypeEntry's that were registered.
       */
      public void update(TypeEntry def) throws IOException;
        
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/UndefinedDelegate.java
  
  Index: UndefinedDelegate.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.io.IOException;
  
  import java.util.Vector;
  
  /**
   * This UndefinedDelegate class implements the common functions of UndefinedType and UndefinedElement.
   */
  public class UndefinedDelegate implements Undefined {
  
      private Vector list;
      private TypeEntry undefinedType;
  
      /**
       * Constructor
       */
      UndefinedDelegate(TypeEntry te) {
          list = new Vector();
          undefinedType = te;
      }
     /**
       *  Register referrant TypeEntry so that 
       *  the code can update the TypeEntry when the Undefined Element or Type is defined
       */
      public void register(TypeEntry referrant) {
          list.add(referrant);
      }
  
      /**
       *  Call update with the actual TypeEntry.  This updates all of the
       *  referrant TypeEntry's that were registered.
       */
      public void update(TypeEntry def) throws IOException {
          boolean done = false;
          while (!done) {
              done = true;  // Assume this is the last pass
  
              // Call updatedUndefined for all items on the list
              // updateUndefined returns true if the state of the te TypeEntry
              // is changed.  The outer loop is traversed until there are no more
              // state changes.
              for (int i=0; i < list.size() ; i++) {
                  TypeEntry te = (TypeEntry) list.elementAt(i);
                  if (te.updateUndefined(undefinedType, def))
                      done = false;  // Items still undefined, need another pass
              }
          }
          // It is possible that the def TypeEntry depends on an Undefined type.
          // If so, register all of the entries with the undefined type.
          TypeEntry uType = def.getUndefinedTypeRef();
          if (uType != null) {
              for (int i=0; i < list.size() ; i++) {
                  TypeEntry te = (TypeEntry) list.elementAt(i);
                  ((Undefined)uType).register(te);
              }
          }
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/UndefinedElement.java
  
  Index: UndefinedElement.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.io.IOException;
  
  import javax.wsdl.QName;
  
  /**
   * This represents a QName found in a reference but is not defined.
   * If the type is later defined, the UndefinedType is replaced with a new Type
   */
  public class UndefinedElement extends Element implements Undefined {
  
      private UndefinedDelegate delegate = null;
  
      /**
       * Construct a referenced (but as of yet undefined) element
       */
      public UndefinedElement(QName pqName) {
          super(pqName, null);
          undefined = true;
          delegate = new UndefinedDelegate(this);
      }
  
      /**
       *  Register referrant TypeEntry so that 
       *  the code can update the TypeEntry when the Undefined Element or Type is defined
       */
      public void register(TypeEntry referrant) {
          delegate.register(referrant);
      }
  
      /**
       *  Call update with the actual TypeEntry.  This updates all of the
       *  referrant TypeEntry's that were registered.
       */
      public void update(TypeEntry def) throws IOException {
          delegate.update(def);
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/UndefinedType.java
  
  Index: UndefinedType.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.io.IOException;
  
  import javax.wsdl.QName;
  
  /**
   * This represents a QName found in a reference but is not defined.
   * If the type is later defined, the UndefinedType is replaced with a new Type
   */
  public class UndefinedType extends Type implements Undefined {
  
     private UndefinedDelegate delegate = null;
  
      /**
       * Construct a referenced (but as of yet undefined) type 
       */
      public UndefinedType(QName pqName) {
          super(pqName, null);
          undefined = true;
          delegate = new UndefinedDelegate(this);
      }
  
      /**
       *  Register referrant TypeEntry so that 
       *  the code can update the TypeEntry when the Undefined Element or Type is defined
       */
      public void register(TypeEntry referrant) {
          delegate.register(referrant);
      }
  
      /**
       *  Call update with the actual TypeEntry.  This updates all of the
       *  referrant TypeEntry's that were registered.
       */
      public void update(TypeEntry def) throws IOException {
          delegate.update(def);
      }
  };
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
  
  Index: Utils.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.symbolTable;
  
  import java.util.HashSet;
  import java.util.Iterator;
  import java.util.Vector;
  
  import javax.wsdl.QName;
  
  import javax.xml.rpc.holders.BooleanHolder;
  import javax.xml.rpc.holders.IntHolder;
  
  import org.apache.axis.Constants;
  
  import org.w3c.dom.NamedNodeMap;
  
  import org.w3c.dom.Node;
  
  /**
   * This class contains static utility methods for the emitter.
   *
   * @author Rich Scheuerle  (scheu@us.ibm.com)
   * @author Tom Jordahl (tomj@macromedia.com)
   */
  public class Utils {
  
      /**
       * getNillableQName returns the QName to use if the nillable=true
       * attribute is used.                             
       * For example, in JAX-RPC:
       *   The QName "xsd:int" maps to a java int.
       *   However if an element with a type="xsd:int" also has the 
       *   "nillable=true" attribute, the type should be an Integer (not an int).
       *   So in these circumstances, this routine is called with xsd:int to 
       *   get a suitable qname (soapenc:int) which maps to Integer.
       * @param QName
       */
      public static QName getNillableQName(QName qName) {
          QName rc = new QName(qName.getNamespaceURI(), qName.getLocalPart());
          if (Constants.isSchemaXSD(rc.getNamespaceURI())) {
              String localName = rc.getLocalPart();
              if (localName.equals("int") ||
                  localName.equals("long") ||
                  localName.equals("short") ||
                  localName.equals("float") ||
                  localName.equals("double") ||
                  localName.equals("boolean") ||
                  localName.equals("byte")) {
                  rc.setNamespaceURI(Constants.URI_CURRENT_SOAP_ENC);
              }
              else if (localName.equals("base64Binary") ||
                       localName.equals("hexBinary")) {
                  rc.setNamespaceURI(Constants.URI_CURRENT_SOAP_ENC);
                  rc.setLocalPart("base64");
              }
          }
         return rc;
      }
      /**
       * Given a node, return the value of the given attribute.
       * If the attribute does not exist, searching continues through ancestor nodes until found.
       * This method is useful for finding attributes that pertain to a group of contained
       * nodes (i.e. xlmns, xmlns:tns, targetNamespace, name)
       */
      public static String getScopedAttribute(Node node, String attr) {
          if (node == null) {
              return null;
          }
  
          if (node.getAttributes() == null)
              return getScopedAttribute(node.getParentNode(), attr);
  
          Node attrNode = node.getAttributes().getNamedItem(attr);
          if (attrNode != null) {
              return attrNode.getNodeValue();
          }
          else {
              return getScopedAttribute(node.getParentNode(), attr);
          }
      }
  
      /**
       * Given a node, return the value of the given attribute.
       * Returns null if the attribute is not found
       */
      public static String getAttribute(Node node, String attr) {
          if (node == null || node.getAttributes() == null) {
              return null;
          }
  
          Node attrNode = node.getAttributes().getNamedItem(attr);
          if (attrNode != null) {
              return attrNode.getNodeValue();
          }
          else {
              return null;
          }
      }
  
      /**
       * Given a node, return the attributes that have the specified local name.
       * Returns null if the attribute is not found
       */
      public static Vector getAttributesWithLocalName(Node node, String localName) {
          Vector v = new Vector();
          if (node == null) {
              return v;
          }
  
          NamedNodeMap map = node.getAttributes();
          if (map != null) {
              for (int i=0; i < map.getLength(); i++) {
                  Node attrNode =  map.item(i);
                  if (attrNode != null &&
                      attrNode.getLocalName().equals(localName)) {
                      v.add(attrNode);
                  }
              }
          }
          return v;    
      }
  
      /**
       * An xml element may have a name.
       * For example &lt.element name="foo" type="b:bar"&gt.
       * has the name "element".  This routine gets the full QName of the element.
       */
      public static QName getNodeQName(Node node) {
          if (node == null) {
              return null;
          }
  
          String localName = node.getLocalName();
          if (localName == null) {
              return null;
          }
          String namespace = node.getNamespaceURI();
  
          return (new QName(namespace, localName));
      }
  
      /**
       * XML nodes may have a name attribute.
       * For example &lt.element name="foo" type="b:bar"&gt.
       * has the name attribute value "foo".  This routine gets the QName of the name attribute value.
       */
      public static QName getNodeNameQName(Node node) {
          if (node == null) {
              return null;
          }
          String localName = null;
          String namespace = null;
  
          // First try to get the name directly
          localName = getAttribute(node, "name");
          
          // If this fails and the node has a ref, use the ref name.
          if (localName == null) {
              QName ref = getNodeTypeRefQName(node, "ref");
              if (ref != null) {
                  localName = ref.getLocalPart();
                  namespace = ref.getNamespaceURI();
              }
          }
          
          // This routine may be called for complexType elements.  In some cases,
          // the complexType may be anonymous, which is why the getScopedAttribute
          // method is used.
          if (localName == null) {
              localName = "";
              Node search = node.getParentNode();
              while(search != null) {
                  QName kind = getNodeQName(search);
                  if (kind.getLocalPart().equals("schema")) {
                      search = null;
                  } else if (kind.getLocalPart().equals("element") ||
                             kind.getLocalPart().equals("attribute")) {
                      localName = SymbolTable.ANON_TOKEN +
                          getNodeNameQName(search).getLocalPart();
                      search = search.getParentNode();
                  } else if (kind.getLocalPart().equals("complexType") ||
                             kind.getLocalPart().equals("simpleType")) {
                      localName = getNodeNameQName(search).getLocalPart() + localName;
                      search = null;
                  } else {
                      search = search.getParentNode();
                  }
              }            
          }
          if (localName == null)
              return null;
  
          // Build and return the QName
          if (namespace == null) {
              namespace = getScopedAttribute(node, "targetNamespace");
          }
          return (new QName(namespace, localName));
      }
  
      /**
       * XML nodes may have a type/ref attribute.
       * For example &lt.element name="foo" type="b:bar"&gt.
       * has the type attribute value "b:bar". 
       * This routine gets the QName of the type/ref attribute value.
       *
       * Note: If the "minOccurs" and "maxOccurs" are set such that the 
       * type is a collection of "types", then an artificial qname is
       * returned to represent the collection.
       * 
       * If you want the QName for just the "type" without analyzing 
       * minOccurs/maxOccurs then use:
       *    getNodeTypeRefQName(node, "type")
       *
       * Note 2: The getNodeTypeRefQName routines also inspect the 
       *         "nillable" attribute and may return an alternate QName
       *         if nillable is true.  
       * 
       * @param node of the reference
       * @param forElement output parameter is set to true if QName is for an element
       *                   (i.e. ref= or element= attribute was used).
       * @param QName of type or element (depending on forElement setting)
       */
      public static QName getNodeTypeRefQName(Node node, BooleanHolder forElement) {
          if (node == null) return null;
          forElement.value = false; // Assume QName returned is for a type
  
          // If the node has "type" and "maxOccurs" then the type is really
          // a collection.  There is no qname in the wsdl which we can use to represent
          // the collection, so we need to invent one.
          // The local part of the qname is changed to <local>[minOccurs, maxOccurs]
          // The namespace uri is changed to the targetNamespace of this node
          QName qName= getNodeTypeRefQName(node, "type");
          if (qName != null) {
              String maxOccursValue = getAttribute(node, "maxOccurs");
              String minOccursValue = getAttribute(node, "minOccurs");
              if (maxOccursValue == null) {
                  maxOccursValue = "1";
              }
              if (minOccursValue == null) {
                  minOccursValue = "1";
              }
              if (minOccursValue.equals("0") && maxOccursValue.equals("1")) {
                  // If we have a minoccurs="0"/maxoccurs="1", this is just
                  // like a nillable single value, so treat it as such.
                  qName = getNillableQName(qName);
              } else if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
                  String localPart = qName.getLocalPart();
  //                localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
  //                qName.setLocalPart(localPart);
  //                String namespace = getScopedAttribute(node, "targetNamespace");
  //                if (namespace != null)
  //                    qName.setNamespaceURI(namespace);
                  localPart += "[" + maxOccursValue + "]";
                  qName.setLocalPart(localPart);
              }
          }
  
          // Both "ref" and "element" reference elements
          if (qName == null) {
              forElement.value = true;
              qName = getNodeTypeRefQName(node, "ref");
          }
          // A WSDL Part uses the element attribute instead of the ref attribute
          if (qName == null) {
              forElement.value = true;
              qName = getNodeTypeRefQName(node, "element");
          }
  
          // "base" references a "type"
          if (qName == null) {
              forElement.value = false;
              qName = getNodeTypeRefQName(node, "base");
          }
          return qName;
      }
  
      /**
       * Obtain the QName of the type/ref using the indicated attribute name.
       * For example, the "type" attribute in an XML enumeration struct is the 
       * "base" attribute. 
       * If the "type" attribute is requested, the "nillable" attribute is 
       * also inspected to see if an alternate qname should be returned.
       *
       * @param node in the dom
       * @param typeAttrName (type, base, element, ref)
       */
      public static QName getNodeTypeRefQName(Node node, String typeAttrName) {
          if (node == null) {
              return null;
          }
          String prefixedName = getAttribute(node, typeAttrName);
  
          // The type attribute defaults to xsd:anyType if there
          // are no other conflicting attributes and no anonymous type.
          if (prefixedName == null &&
              typeAttrName.equals("type")) {
              if (getAttribute(node, "ref") == null &&
                  getAttribute(node, "base") == null && 
                  getAttribute(node, "element") == null &&
                  SchemaUtils.getElementAnonQName(node) == null) {
                  QName nodeName = getNodeQName(node);
                  if (nodeName != null &&
                      Constants.isSchemaXSD(nodeName.getNamespaceURI()) &&
                      (nodeName.getLocalPart().equals("element") ||
                       nodeName.getLocalPart().equals("attribute"))) {
                      return getWSDLQName(Constants.XSD_ANYTYPE);
                  }
              }              
          }
           
          // Return null if not found
          if (prefixedName == null) {
              return null;
          }
          // Change the prefixed name into a full qname
          QName qName = getQNameFromPrefixedName(node,prefixedName);
  
          // An alternate qname is returned if nillable
          if (typeAttrName.equals("type")) {
              String nillable = getAttribute(node, "nillable");
              if (nillable != null && nillable.equalsIgnoreCase("true")) {
                  qName = getNillableQName(qName);
              }
          }
          return qName;
      }
  
      /**
       * Convert a prefixed name into a qname
       */
      public static QName getQNameFromPrefixedName(Node node, String prefixedName) {
   
          String localName = prefixedName.substring(prefixedName.lastIndexOf(":")+1);
          String namespace = null;
          // Associate the namespace prefix with a namespace
          if (prefixedName.length() == localName.length()) {
             namespace = getScopedAttribute(node, "xmlns");  // Get namespace for unqualified reference
          }
          else {
             namespace = getScopedAttribute(node, "xmlns:" + prefixedName.substring(0, prefixedName.lastIndexOf(":")));
          }
          return (new QName(namespace, localName));
      }
  
      /**
       * This method returns a set of all types that are derived
       * from this type via an extension of a complexType
       */
      public static HashSet getDerivedTypes(TypeEntry type, SymbolTable symbolTable) {
          HashSet types = new HashSet();
          if (type != null && type.getNode() != null) {
              getDerivedTypes(type, types, symbolTable);
          } else if (Constants.isSchemaXSD(type.getQName().getNamespaceURI()) &&
                     type.getQName().getLocalPart().equals("anyType")) {
              // All types are derived from anyType
              types.addAll(symbolTable.getTypes());
          }
          return types;
      } // getNestedTypes
  
      private static void getDerivedTypes(
              TypeEntry type, HashSet types, SymbolTable symbolTable) {
  
          // If all types are in the set, return
          if (types.size() == symbolTable.getTypes().size()) {
              return;
          }
  
          // Search the dictionary for derived types of type
          Vector allTypes = symbolTable.getTypes();
          Iterator it = allTypes.iterator();
          while(it.hasNext()) {
              TypeEntry derivedType = (TypeEntry) it.next();
              if (derivedType instanceof DefinedType &&
                  derivedType.getNode() != null &&
                  !types.contains(derivedType) &&
                  SchemaUtils.getComplexElementExtensionBase(
                     derivedType.getNode(),
                     symbolTable) == type) {
                  types.add(derivedType);
                  getDerivedTypes(derivedType, types, symbolTable);
              }
          }
      } // getDerivedTypes
  
      /**
       * This method returns a set of all the nested types.
       * Nested types are types declared within this TypeEntry (or descendents)
       * plus any extended types and the extended type nested types
       * The elements of the returned HashSet are Types.
       * @param type is the type entry to consider
       * @param symbolTable is the symbolTable
       * @param derivedFlag should be set if all dependendent derived types should also be 
       * returned.
       */
      public static HashSet getNestedTypes(TypeEntry type, SymbolTable symbolTable, 
                                           boolean derivedFlag) {
          HashSet types = new HashSet();
          getNestedTypes(type, types, symbolTable, derivedFlag);
          return types;
      } // getNestedTypes
  
      private static void getNestedTypes(
              TypeEntry type, HashSet types, SymbolTable symbolTable, 
              boolean derivedFlag) {
  
          if (type == null) {
              return;
          }
          
          // If all types are in the set, return
          if (types.size() == symbolTable.getTypes().size()) {
              return;
          }
          
          // Process types derived from this type
          if (derivedFlag) {
              HashSet derivedTypes = getDerivedTypes(type, symbolTable);
              Iterator it = derivedTypes.iterator();
              while(it.hasNext()) {
                  TypeEntry derivedType = (TypeEntry) it.next();
                  if (!types.contains(derivedType)) {
                      types.add(derivedType);
                      getNestedTypes(derivedType, types, symbolTable, derivedFlag);
                  }
              }
          }
          
          // Continue only if the node exists
          if(type.getNode() == null) {
              return;
          }
          Node node = type.getNode();
  
          // Process types declared in this type
          Vector v = SchemaUtils.getContainedElementDeclarations(node, symbolTable);
          if (v != null) {
              for (int i = 0; i < v.size(); i++) {
                  ElementDecl elem = (ElementDecl)v.get(i);
                  if (!types.contains(elem.getType())) {
                      types.add(elem.getType());
                      getNestedTypes(elem.getType(), 
                                     types, 
                                     symbolTable, derivedFlag);
                  }
              }
          }
  
          // Process attributes declared in this type
          v = SchemaUtils.getContainedAttributeTypes(node, symbolTable);
          if (v != null) {
              for (int i = 0; i < v.size(); i+=2) {
                  if (!types.contains(v.get(i))) {
                      types.add(v.get(i));
                      getNestedTypes(
                              ((TypeEntry) v.get(i)), types, symbolTable, derivedFlag);
                  }
              }
          }
          
          // Get the anonymous type of the element
          QName anonQName = SchemaUtils.getElementAnonQName(node);
          if (anonQName != null) {
              TypeEntry anonType = symbolTable.getType(anonQName);
              if (anonType != null && !types.contains(anonType)) {
                  types.add(anonType);
              }
          }
  
          // Process extended types
          TypeEntry extendType = SchemaUtils.getComplexElementExtensionBase(node, symbolTable);
          if (extendType != null) {
              if (!types.contains(extendType)) {
                  types.add(extendType);
                  getNestedTypes(extendType, types, symbolTable, derivedFlag);
              }
          }
  
          // Process array element types
          QName elementQName = SchemaUtils.getArrayElementQName(node, new IntHolder(0));
          TypeEntry elementType = symbolTable.getType(elementQName);
          if (elementType != null) {
              if (!types.contains(elementType)) {
                  types.add(elementType);
                  getNestedTypes(elementType, types, symbolTable, derivedFlag);
              }
          }
      } // getNestedTypes
  
      /**
       * Common code for generating a QName in emitted code.  Note that there's
       * no semicolon at the end, so we can use this in a variety of contexts.
       */ 
      public static String getNewQName(javax.xml.rpc.namespace.QName qname)
      {
          return "new javax.xml.rpc.namespace.QName(\"" +
                  qname.getNamespaceURI() + "\", \"" +
                  qname.getLocalPart() + "\")";
      }
      
      public static javax.xml.rpc.namespace.QName getAxisQName(QName qname)
      {
          if (qname == null) {
              return null;
          }
          return new javax.xml.rpc.namespace.QName(qname.getNamespaceURI(),
                                                   qname.getLocalPart());
      }
      
      public static QName getWSDLQName(javax.xml.rpc.namespace.QName qname)
      {
          if (qname == null) {
              return null;
          }
          return new QName(qname.getNamespaceURI(), qname.getLocalPart());
      }
      
      /**
       * Generate an XML prefixed attribute value with a corresponding xmlns 
       * declaration for the prefix.  If there is no namespace, 
       * don't prefix the name or emit the xmlns attribute.
       * 
       * Caller should provide the enclosing quotes.
       * 
       * Usage:  println("name=\"" + genXMLQNameString(qname, "foo") + "\""
       */ 
      public static String genQNameAttributeString(QName qname, String prefix) {
          String result;
          if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals(""))
              return qname.getLocalPart();
          
          return prefix + ":" + qname.getLocalPart() + "\" xmlns:" + prefix +
                  "=\"" + qname.getNamespaceURI();
      }
  }
  
  
  
  
  
  
  
  1.35      +501 -426  xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Emitter.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- Emitter.java	7 May 2002 19:52:02 -0000	1.34
  +++ Emitter.java	9 May 2002 13:14:28 -0000	1.35
  @@ -54,28 +54,36 @@
    */
   package org.apache.axis.wsdl.toJava;
   
  -import org.apache.axis.utils.CLArgsParser;
  -import org.apache.axis.utils.CLOption;
  -import org.apache.axis.utils.CLOptionDescriptor;
  -import org.apache.axis.utils.CLUtil;
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.utils.XMLUtils;
  -import org.w3c.dom.Document;
  -
  -import javax.wsdl.Binding;
  -import javax.wsdl.Definition;
  -import javax.wsdl.WSDLException;
  -import javax.wsdl.factory.WSDLFactory;
  -import javax.wsdl.xml.WSDLReader;
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.IOException;
  +
  +import java.net.Authenticator;
  +import java.net.PasswordAuthentication;
  +import java.net.MalformedURLException;
  +import java.net.URL;
  +
   import java.util.Enumeration;
   import java.util.HashMap;
  -import java.util.Iterator;
   import java.util.List;
   import java.util.Properties;
  -import java.util.Vector;
  +
  +import javax.wsdl.Definition;
  +import javax.wsdl.QName;
  +import javax.wsdl.WSDLException;
  +
  +import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
  +import org.apache.axis.encoding.DefaultTypeMappingImpl;
  +import org.apache.axis.encoding.TypeMapping;
  +
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.axis.wsdl.gen.GeneratorFactory;
  +import org.apache.axis.wsdl.gen.Parser;
  +
  +import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
  +
  +import org.w3c.dom.Document;
   
   /**
    * This class produces java files for stubs, skeletons, and types from a
  @@ -86,199 +94,42 @@
    * @author Rich Scheuerle (scheu@us.ibm.com)
    * @author Steve Graham (sggraham@us.ibm.com)
    */
  -public class Emitter {
  +public class Emitter extends Parser {
  +
       // Scope constants
       public static final byte NO_EXPLICIT_SCOPE = 0x00;
       public static final byte APPLICATION_SCOPE = 0x01;
       public static final byte REQUEST_SCOPE     = 0x10;
       public static final byte SESSION_SCOPE     = 0x11;
   
  -    protected Document doc = null;
  -    protected Definition def = null;
  -    protected boolean bDebug = false;
  -    protected boolean bEmitServer = false;
  -    protected boolean bDeploySkeleton = false;
  -    protected boolean bEmitTestCase = false;
  -    protected boolean bVerbose = false;
  -    protected boolean bGenerateImports = true;
  -    protected boolean bGenerateAll = false;
  -    protected boolean bHelperGeneration = false;
  -    protected String outputDir = null;
  -    protected String packageName = null;
  -    protected byte scope = NO_EXPLICIT_SCOPE;
  -    protected GeneratedFileInfo fileInfo = new GeneratedFileInfo(); 
  +    protected HashMap namespaceMap = new HashMap();
  +    protected String typeMappingVersion = "1.2";
  +    protected BaseTypeMapping baseTypeMapping = null;
       protected Namespaces namespaces = null;
  -    protected HashMap delaySetMap = null;
  -    protected WriterFactory writerFactory = null;
  -    protected SymbolTable symbolTable = null;
  -    protected String currentWSDLURI = null;
       protected String NStoPkgFilename = "NStoPkg.properties";
       protected File NStoPkgFile = null;
  -    protected String username = null;
  -    protected String password = null;
   
  +    private boolean bEmitServer = false;
  +    private boolean bDeploySkeleton = false;
  +    private boolean bEmitTestCase = false;
  +    private boolean bGenerateAll = false;
  +    private boolean bHelperGeneration = false;
  +    private String packageName = null;
  +    private byte scope = NO_EXPLICIT_SCOPE;
  +    private GeneratedFileInfo fileInfo = new GeneratedFileInfo();
  +    private HashMap delayedNamespacesMap = new HashMap();
  +    private String outputDir = null;
  +
  +    // Timeout, in milliseconds, to let the Emitter do its work
  +    private long timeoutms = 45000; // 45 sec default
   
       /**
        * Default constructor.
        */
  -    public Emitter(WriterFactory writerFactory) {
  -        this.writerFactory = writerFactory;
  +    public Emitter () {
  +        setFactory(new JavaGeneratorFactory(this));
       } // ctor
   
  -    /**
  -     * Sets the <code>WriterFactory Class</code> to use
  -     * @param className the name of the factory <code>Class</code> 
  -     */
  -    public void setFactory(String className) {
  -        try {
  -            ClassLoader cl = Thread.currentThread().getContextClassLoader();
  -            writerFactory = (WriterFactory) 
  -                Class.forName(className, true,cl).newInstance();
  -            writerFactory.setEmitter(this);
  -        }
  -        catch (Exception ex) {
  -            ex.printStackTrace();
  -        }
  -    }
  -
  -    public SymbolTable getSymbolTable() { return symbolTable;}
  -    public WriterFactory getWriterFactory() { return writerFactory;}
  -    /**
  -     * Call this method if you have a uri for the WSDL document
  -     * @param uri wsdlURI the location of the WSDL file.
  -     */
  -    public void emit(String uri) throws IOException, WSDLException {
  -        if (bVerbose)
  -            System.out.println(JavaUtils.getMessage("parsing00", uri));
  -
  -        Document doc = XMLUtils.newDocument(uri, username, password);
  -
  -        if (doc == null) {
  -            throw new IOException(JavaUtils.getMessage("cantGetDoc00", uri));
  -        }
  -        emit(uri, doc);
  -    } // emit
  -
  -    /**
  -     * Call this method if your WSDL document has already been parsed as an XML DOM document.
  -     * @param context context This is directory context for the Document.  If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work).  If context is null, then the context becomes the current directory.
  -     * @param doc doc This is the XML Document containing the WSDL.
  -     */
  -    public void emit(String context, Document doc) throws IOException, WSDLException {
  -        currentWSDLURI = context;
  -        WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
  -        reader.setFeature("javax.wsdl.verbose", bVerbose);
  -        def = reader.readWSDL(context, doc);
  -        this.doc = doc;
  -        namespaces = new Namespaces(outputDir);
  -
  -        if (packageName != null) {
  -             namespaces.setDefaultPackage(packageName);
  -        } else {
  -            // First, read the namespace mapping file - configurable, by default
  -            // NStoPkg.properties - if it exists, and load the namespaceMap HashMap
  -            // with its data.
  -            getNStoPkgFromPropsFile(namespaces);
  -            
  -            if (delaySetMap != null) {
  -                namespaces.putAll(delaySetMap);
  -            }
  -        }
  -
  -        symbolTable = new SymbolTable(namespaces,
  -                                      writerFactory.getBaseTypeMapping(),
  -                                      bGenerateImports,
  -                                      bDebug);
  -        symbolTable.add(context, def, doc);
  -        writerFactory.writerPass(def, symbolTable);
  -        if (bDebug) {
  -            symbolTable.dump(System.out);
  -        }
  -        emit(def, doc);
  -
  -        // Output extra stuff (deployment files and faults) 
  -        // outside of the recursive emit method.
  -        Writer writer = writerFactory.getWriter(def, symbolTable);
  -        writer.write();
  -        currentWSDLURI = null;
  -    } // emit
  -
  -    private void emit(Definition def, Document doc) throws IOException, WSDLException {
  -        // Output Java classes for types
  -        writeTypes();
  -
  -        Iterator it = symbolTable.getHashMap().values().iterator();
  -        while (it.hasNext()) {
  -            Vector v = (Vector) it.next();
  -            for (int i = 0; i < v.size(); ++i) {
  -                SymTabEntry entry = (SymTabEntry) v.elementAt(i);
  -                Writer writer = null;
  -                if (entry instanceof MessageEntry) {
  -                    writer = writerFactory.getWriter(
  -                            ((MessageEntry) entry).getMessage(), symbolTable);
  -                }
  -                else if (entry instanceof PortTypeEntry) {
  -                    PortTypeEntry pEntry = (PortTypeEntry) entry;
  -                    // If the portType is undefined, then we're parsing a Definition
  -                    // that didn't contain a portType, merely a binding that referred
  -                    // to a non-existent port type.  Don't bother writing it.
  -                    if (pEntry.getPortType().isUndefined()) {
  -                        continue;
  -                    }
  -                    writer = writerFactory.getWriter(pEntry.getPortType(),
  -                            symbolTable);
  -                }
  -                else if (entry instanceof BindingEntry) {
  -                    BindingEntry bEntry = (BindingEntry)entry;
  -                    Binding binding = bEntry.getBinding();
  -
  -                    // If the binding is undefined, then we're parsing a Definition
  -                    // that didn't contain a binding, merely a service that referred
  -                    // to a non-existent binding.  Don't bother writing it.
  -                    if (binding.isUndefined()) {
  -                        continue;
  -                    }
  -                    writer = writerFactory.getWriter(binding, symbolTable);
  -                }
  -                else if (entry instanceof ServiceEntry) {
  -                    writer = writerFactory.getWriter(
  -                            ((ServiceEntry) entry).getService(), symbolTable);
  -                }
  -                if (writer != null) {
  -                    writer.write();
  -                }
  -            }
  -        }
  -    } // emit
  -
  -    /**
  -     * Look for a NStoPkg.properties file in the CLASSPATH.  If it exists,
  -     * then collect the namespace->package mappings from it.
  -     */
  -    private void getNStoPkgFromPropsFile(HashMap namespaces)
  -    {
  -        try {
  -            Properties mappings = new Properties();
  -            if (NStoPkgFile != null) {
  -                mappings.load(new FileInputStream(NStoPkgFile));
  -            }
  -            else {
  -                mappings.load(new FileInputStream(NStoPkgFilename));
  -            }
  -            Enumeration keys = mappings.propertyNames();
  -            while (keys.hasMoreElements()) {
  -                try {
  -                    String key = (String) keys.nextElement();
  -                    namespaces.put(key, mappings.getProperty(key));
  -                }
  -                catch (Throwable t) {
  -                }
  -            }
  -        }
  -        catch (Throwable t) {
  -        }
  -    } // getNStoPkgFromPropsFile
  -
       ///////////////////////////////////////////////////
       //
       // Command line switches
  @@ -288,29 +139,29 @@
        * Turn on/off server skeleton creation
        * @param value
        */
  -    public void generateServerSide(boolean value) {
  +    public void setGenerateServerSide(boolean value) {
           this.bEmitServer = value;
  -    }
  +    } // setGenerateServerSide
   
       /**
        * Indicate if we should be emitting server side code and deploy/undeploy
        */ 
  -    public boolean getGenerateServerSide() {
  +    public boolean generateServerSide() {
           return bEmitServer;
  -    }
  +    } // generateServerSide
   
       /**
        * Turn on/off server skeleton deploy
        * @param value
        */
  -    public void deploySkeleton(boolean value) {
  +    public void setDeploySkeleton(boolean value) {
           bDeploySkeleton = value;
       }
   
       /**
        * Indicate if we should be deploying skeleton or implementation
        */ 
  -    public boolean getDeploySkeleton() {
  +    public boolean deploySkeleton() {
           return bDeploySkeleton;
       }
   
  @@ -318,14 +169,14 @@
        * Turn on/off Helper class generation
        * @param value
        */
  -    public void setHelperGeneration(boolean value) {
  +    public void setGenerateHelper(boolean value) {
           bHelperGeneration = value;
       }
   
       /**
        * Indicate if we should be generating Helper classes           
        */ 
  -    public boolean getHelperGeneration() {
  +    public boolean generateHelper() {
           return bHelperGeneration;
       }
   
  @@ -333,107 +184,61 @@
        * Turn on/off test case creation
        * @param value
        */
  -    public void generateTestCase(boolean value) {
  +    public void setGenerateTestCase(boolean value) {
           this.bEmitTestCase = value;
  -    }
  +    } // setGenerateTestCase
   
  -    /**
  -     * Return the current definition
  -     */ 
  -    public Definition getCurrentDefinition() {
  -        return this.def;
  -    }
  -    
  -    /**
  -     * Turn on/off generation of elements from imported files.
  -     * @param generateImports
  -     */
  -    public void generateImports(boolean generateImports) {
  -        this.bGenerateImports = generateImports;
  -    } // generateImports
  +    public boolean generateTestCase() {
  +        return bEmitTestCase;
  +    } // geneateTestCase
   
       /**
        * By default, code is generated only for referenced elements.
  -     * Call generateAll(true) and WSDL2Java will generate code for all
  +     * Call bGenerateAll(true) and WSDL2Java will generate code for all
        * elements in the scope regardless of whether they are
        * referenced.  Scope means:  by default, all WSDL files; if
        * generateImports(false), then only the immediate WSDL file.
        */
  -     public void generateAll(boolean all) {
  -         bGenerateAll = all;
  -     } // generateAll
  +    public void setGenerateAll(boolean all) {
  +        bGenerateAll = all;
  +    } // setbGenerateAll
  +
  +    public boolean generateAll() {
  +        return bGenerateAll;
  +    } // bGenerateAll
   
  -    /**
  -     * Turn on/off debug messages.
  -     * @param value
  -     */
  -    public void debug(boolean value) {
  -        bDebug = value;
  -    } // debug
  -
  -    /**
  -     * Return the status of the debug switch.
  -     */
  -    public boolean getDebug() {
  -        return bDebug;
  -    } // getDebug
  -
  -    /**
  -     * Turn on/off verbose messages
  -     * @param value
  -     */
  -    public void verbose(boolean value) {
  -        this.bVerbose = value;
  -    }
  -
  -    /**
  -     * Return the status of the verbose switch
  -     */ 
  -    public boolean getVerbose() {
  -        return this.bVerbose;
  -    }
  +    public Namespaces getNamespaces() {
  +        return namespaces;
  +    } // getNamespaces
   
       /**
  -     * Set a map of namespace -> Java package names
  -     */ 
  -    public void setNamespaceMap(HashMap map) {
  -        delaySetMap = map;
  -    }
  -    /**
  -     * Get the map of namespace -> Java package names
  -     */ 
  -    public HashMap getNamespaceMap() {
  -        return delaySetMap;
  +      * Set the output directory to use in emitted source files
  +      */
  +    public void setOutputDir(String outputDir) {
  +        this.outputDir = outputDir;
       }
   
       /**
  -     * Set the output directory to use in emitted source files
  +     * Get the output directory to use for emitted source files
        */
  -    public void setOutputDir(String outputDir) {
  -        this.outputDir = outputDir;
  +    public String getOutputDir() {
  +        return outputDir;
       }
   
       /**
        * Get global package name to use instead of mapping namespaces
  -     */ 
  +     */
       public String getPackageName() {
           return packageName;
       }
   
       /**
        * Set a global package name to use instead of mapping namespaces
  -     */ 
  +     */
       public void setPackageName(String packageName) {
           this.packageName = packageName;
       }
  -    
  -    /**
  -     * Get the output directory to use for emitted source files
  -     */
  -    public String getOutputDir() {
  -        return this.outputDir;
  -    }
  -    
  +
       /**
        * Set the scope for the deploy.xml file.
        * @param scope One of Emitter.NO_EXPLICIT_SCOPE, Emitter.APPLICATION_SCOPE, Emitter.REQUEST_SCOPE, Emitter.SESSION_SCOPE.  Anything else is equivalent to NO_EXPLICIT_SCOPE and no explicit scope tag will appear in deploy.xml.
  @@ -450,7 +255,7 @@
       } // getScope
   
       /**
  -     * set the package to namespace mappings filename
  +     * Set the NStoPkg mappings filename.
        */
       public void setNStoPkg(String NStoPkgFilename) {
           if (NStoPkgFilename != null) {
  @@ -459,215 +264,485 @@
       } // setNStoPkg
   
       /**
  -     * set the package to namespace mappings file
  +     * Set the NStoPkg mappings file.
        */
       public void setNStoPkg(File NStoPkgFile) {
           this.NStoPkgFile = NStoPkgFile;
       } // setNStoPkg
   
       /**
  -     * Get the username needed to access the WSDL
  +     * Set a map of namespace -> Java package names
        */ 
  -    public String getUsername() {
  -        return username;
  +    public void setNamespaceMap(HashMap map) {
  +        delayedNamespacesMap = map;
       }
   
       /**
  -     * Set the username needed to access the WSDL
  +     * Get the map of namespace -> Java package names
        */ 
  -    public void setUsername(String username) {
  -        this.username = username;
  +    public HashMap getNamespaceMap() {
  +        return delayedNamespacesMap;
       }
   
       /**
  -     * Get the password needed to access the WSDL
  -     */ 
  -    public String getPassword() {
  -        return password;
  +     * Return the current timeout setting
  +     */
  +    public long getTimeout() {
  +        return timeoutms;
       }
   
       /**
  -     * Set the username needed to access the WSDL
  -     */ 
  -    public void setPassword(String password) {
  -        this.password = password;
  +     * Set the timeout, in milliseconds
  +     */
  +    public void setTimeout(long timeout) {
  +        this.timeoutms = timeout;
       }
  -    ///////////////////////////////////////////////////
  +
  +   /**
  +    * Sets the <code>WriterFactory Class</code> to use
  +    * @param className the name of the factory <code>Class</code> 
  +    */
  +    public void setFactory(String factory) {
  +        try {
  +            ClassLoader cl = Thread.currentThread().getContextClassLoader();
  +            setFactory((GeneratorFactory)
  +                       Class.forName(factory, true, cl).newInstance());
  +        }
  +        catch (Exception ex) {
  +            ex.printStackTrace();
  +        }
  +    } // setFactory
  +
       //
  -    // Implementation
  +    // Command line switches
       //
  +    ///////////////////////////////////////////////////
  +
  +    /**
  +     * Returns an object which contains of information on all generated files
  +     * including the class name, filename and a type string.
  +     *
  +     * @return Anorg.apache.axis.wsdl.toJava.GeneratedFileInfo object
  +     * @see org.apache.axis.wsdl.toJava.GeneratedFileInfo
  +     */
  +    public GeneratedFileInfo getGeneratedFileInfo()
  +    {
  +        return fileInfo;
  +    }
   
       /**
        * This method returns a list of all generated class names.
        */
       public List getGeneratedClassNames() {
  -        return this.fileInfo.getClassNames();
  +        return fileInfo.getClassNames();
       }
   
       /**
        * This method returns a list of all generated file names.
        */
       public List getGeneratedFileNames() {
  -        return this.fileInfo.getFileNames();
  +        return fileInfo.getFileNames();
       }
   
       /**
  -     * This method returns an object which contains of all generated files
  -     * including the class name, filename and a type string.
  -     */ 
  -    public GeneratedFileInfo getGeneratedFileInfo() {
  -        return this.fileInfo;
  +     * Get the Package name for the specified namespace
  +     */
  +    public String getPackage(String namespace) {
  +        return (String) namespaces.getCreate(namespace);
       }
  -    
  -    //////////////////////////////
  -    //
  -    // Methods using types (non WSDL)
  -    //
   
       /**
  -     * Generate bindings (classes and class holders) for the complex types.
  -     * If generating serverside (skeleton) spit out beanmappings
  +     * Get the Package name for the specified QName
        */
  -    protected void writeTypes() throws IOException {
  -        Vector types = symbolTable.getTypes();
  -        for (int i = 0; i < types.size(); ++i) {
  -            TypeEntry type = (TypeEntry) types.elementAt(i);
  -
  -            // Write out the type if and only if:
  -            //  - we found its definition (getNode())
  -            //  - it is referenced 
  -            //  - it is not a base java type
  -            //  - it is a Type (not an Element)
  -            // (Note that types that are arrays are passed to getWriter
  -            //  because they may require a Holder)
  -            if (type.getNode() != null && 
  -                type instanceof Type &&
  -                type.isReferenced() && 
  -                type.getBaseType() == null) {
  -                Writer writer = writerFactory.getWriter(type, symbolTable);
  -                writer.write();
  -            }
  +    public String getPackage(QName qName) {
  +        return getPackage(qName.getNamespaceURI());
  +    }
  +
  +    /**
  +     * Convert the specified QName into a full Java Name.
  +     */
  +    public String getJavaName(QName qName) {
  +
  +        // If this is one of our special 'collection' qnames.
  +        // get the element type and append []
  +        if (qName.getLocalPart().indexOf("[") > 0) {
  +            String localPart = qName.getLocalPart().substring(0,qName.getLocalPart().indexOf("["));
  +            QName eQName = new QName(qName.getNamespaceURI(), localPart);
  +            return getJavaName(eQName) + "[]";
           }
  -    } // writeTypes
   
  -    //
  -    // Methods using types (non WSDL)
  -    //
  -    //////////////////////////////
  +        // Handle the special "java" namespace for types
  +        if (qName.getNamespaceURI().equalsIgnoreCase("java")) {
  +            return qName.getLocalPart();
  +        }
   
  -    ///////////////////////////////////////////////////
  -    //
  -    // Utility methods
  -    //
  -    public Namespaces getNamespaces() {
  -        return namespaces;
  -    } // getNamespaces
  +        // The QName may represent a base java name, so check this first
  +        String fullJavaName = getFactory().getBaseTypeMapping().getBaseName(qName);
  +        if (fullJavaName != null) 
  +            return fullJavaName;
  +        
  +        // Use the namespace uri to get the appropriate package
  +        String pkg = getPackage(qName.getNamespaceURI());
  +        if (pkg != null) {
  +            fullJavaName = pkg + "." + Utils.xmlNameToJavaClass(qName.getLocalPart());
  +        } else {
  +            fullJavaName = Utils.xmlNameToJavaClass(qName.getLocalPart());
  +        }
  +        return fullJavaName;
  +    } // getJavaName
   
  -    public String getWSDLURI() {
  -        return currentWSDLURI;
  -    }
   
  +    /**
  +     * Emit appropriate Java files for a WSDL at a given URL.
  +     *
  +     * This method will time out after the number of milliseconds specified
  +     * by our timeoutms member.
  +     *
  +     */
  +    public void run(String wsdlURL) throws IOException, WSDLException {
  +        setup();
   
  +        // Set username and password if provided in URL
  +        checkForAuthInfo(wsdlURL);
  +        Authenticator.setDefault(new DefaultAuthenticator(getUsername(), getPassword()));
   
  -    //
  -    // Utility methods
  -    //
  -    ///////////////////////////////////////////////////
  +        Timer timer = startTimer();
  +        super.run(wsdlURL);
  +        timer.stop();
  +    } // run
   
       /**
  -     * Note:  this main and its assocated stuff is only intended as a test mechanism.  I frequently
  -     * want to test whether the symbol table is constructed properly without having any code
  -     * generated.  Invoking this main method does that.
  -     */
  -    private static final int HELP_OPT = 'h';
  -    private static final int VERBOSE_OPT = 'v';
  -    private static final int DEBUG_OPT = 'D';
  -
  -    private static final CLOptionDescriptor[] options = new CLOptionDescriptor[]{
  -        new CLOptionDescriptor("help",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                HELP_OPT,
  -                JavaUtils.getMessage("optionHelp00")),
  -        new CLOptionDescriptor("verbose",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                VERBOSE_OPT,
  -                JavaUtils.getMessage("optionVerbose00")),
  -        new CLOptionDescriptor("Debug",
  -                CLOptionDescriptor.ARGUMENT_DISALLOWED,
  -                DEBUG_OPT,
  -                JavaUtils.getMessage("optionDebug00"))
  -    };
  -
  -    private static void printUsage() {
  -        String lSep = System.getProperty("line.separator");
  -        StringBuffer msg = new StringBuffer();
  -        msg.append(
  -                "java " + Emitter.class.getName() + " [options] WSDL-URI")
  -                .append(lSep);
  -        msg.append(lSep);
  -        msg.append(CLUtil.describeOptions(options).toString());
  -        System.out.println(msg.toString());
  -        System.exit(1);
  -    } // printUsage
  -
  -    public static void main(String[] args) {
  -        String wsdlURI = null;
  -        Emitter emitter = new Emitter(new NoopWriterFactory());
  -
  -        // Parse the arguments
  -        CLArgsParser parser = new CLArgsParser(args, options);
  -
  -        // Print parser errors, if any
  -        if (null != parser.getErrorString()) {
  -            printUsage();
  -        }
  -
  -        // Get a list of parsed options
  -        List clOptions = parser.getArguments();
  -        int size = clOptions.size();
  +     * Call this method if your WSDL document has already been parsed as an XML DOM document.
  +     * @param context context This is directory context for the Document.  If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work).  If context is null, then the context becomes the current directory.
  +     * @param doc doc This is the XML Document containing the WSDL.
  +     */
  +    public void run(String context, Document doc) throws IOException, WSDLException {
  +        setup();
  +        Timer timer = startTimer();
  +        super.run(context, doc);
  +        timer.stop();
  +    } // run
  +
  +    private void setup() {
  +        addGenerators();
  +
  +        if (baseTypeMapping == null) {
  +            setTypeMappingVersion(typeMappingVersion);
  +        }
  +        getFactory().setBaseTypeMapping(baseTypeMapping);
  +
  +        namespaces = new Namespaces(outputDir);
  +
  +        if (packageName != null) {
  +             namespaces.setDefaultPackage(packageName);
  +        } else {
  +            // First, read the namespace mapping file - configurable, by default
  +            // NStoPkg.properties - if it exists, and load the namespaceMap HashMap
  +            // with its data.
  +            getNStoPkgFromPropsFile(namespaces);
  +            
  +            if (delayedNamespacesMap != null) {
  +                namespaces.putAll(delayedNamespacesMap);
  +            }
  +        }
  +    } // setup
  +
  +    private void addGenerators() {
  +        JavaGeneratorFactory factory = (JavaGeneratorFactory) getFactory();
  +        factory.addGenerator(Definition.class, JavaDefinitionWriter.class); // for faults
  +        factory.addGenerator(Definition.class, JavaDeployWriter.class); // for deploy.wsdd
  +        factory.addGenerator(Definition.class, JavaUndeployWriter.class); // for undeploy.wsdd
  +    } // addGenerators
  +
  +    private Timer startTimer() {
  +        // We run a timout thread that can kill this one if it goes too long.
  +        Timer timer = new Timer(Thread.currentThread(), timeoutms);
  +        Thread timerThread = new Thread(timer);
  +        timerThread.setDaemon(true);
  +        timerThread.start();
  +        return timer;
  +    } // startTimer
   
  +    /**
  +     * Look for a NStoPkg.properties file in the CLASSPATH.  If it exists,
  +     * then collect the namespace->package mappings from it.
  +     */
  +    private void getNStoPkgFromPropsFile(HashMap namespaces)
  +    {
           try {
  -            // Parse the options and configure the emitter as appropriate.
  -            for (int i = 0; i < size; i++) {
  -                CLOption option = (CLOption)clOptions.get(i);
  -
  -                switch (option.getId()) {
  -                    case CLOption.TEXT_ARGUMENT:
  -                        if (wsdlURI != null) {
  -                            printUsage();
  +            Properties mappings = new Properties();
  +            if (NStoPkgFile != null) {
  +                mappings.load(new FileInputStream(NStoPkgFile));
  +            }
  +            else {
  +                mappings.load(new FileInputStream(NStoPkgFilename));
  +            }
  +            Enumeration keys = mappings.propertyNames();
  +            while (keys.hasMoreElements()) {
  +                try {
  +                    String key = (String) keys.nextElement();
  +                    namespaces.put(key, mappings.getProperty(key));
  +                }
  +                catch (Throwable t) {
  +                }
  +            }
  +        }
  +        catch (Throwable t) {
  +        }
  +    } // getNStoPkgFromPropsFile
  +
  +    private class Timer implements Runnable {
  +        private Thread wsdl2JavaThread;
  +        private long timeout;
  +        private boolean stop = false;
  +
  +        public Timer(Thread wsdl2JavaThread, long timeout) {
  +            this.wsdl2JavaThread = wsdl2JavaThread;
  +            this.timeout = timeout;
  +        }
  +
  +        public void run() {
  +            try {
  +                if (timeout > 0)
  +                    wsdl2JavaThread.join(timeoutms);
  +                else
  +                    wsdl2JavaThread.join();
  +            }
  +            catch (InterruptedException e) {
  +            }
  +
  +            if (!stop && wsdl2JavaThread.isAlive()) {
  +                // Calling this:  wsdl2JavaThread.interrupt();
  +                // doesn't accomplish anything, so just exit.
  +                System.out.println(JavaUtils.getMessage("timedOut"));
  +                System.exit(1);
  +            }
  +        } // run
  +
  +        public void stop() {
  +            stop = true;
  +        } // stop
  +        
  +    } // class Timer
  +
  +    public void setTypeMappingVersion(String typeMappingVersion) {
  +        if (typeMappingVersion.equals("1.1")) {
  +            baseTypeMapping =
  +                    new BaseTypeMapping() {
  +                        final TypeMapping defaultTM = DefaultTypeMappingImpl.getSingleton();
  +                        public String getBaseName(QName qNameIn) {
  +                            javax.xml.rpc.namespace.QName qName =
  +                                new javax.xml.rpc.namespace.QName(
  +                                  qNameIn.getNamespaceURI(),
  +                                  qNameIn.getLocalPart());
  +                            Class cls = defaultTM.getClassForQName(qName);
  +                            if (cls == null)
  +                                return null;
  +                            else
  +                                return JavaUtils.getTextClassName(cls.getName());
  +                        }
  +                    };
  +        } else {
  +            baseTypeMapping =
  +                    new BaseTypeMapping() {
  +                        final TypeMapping defaultTM = DefaultSOAP12TypeMappingImpl.create();
  +                        public String getBaseName(QName qNameIn) {
  +                            javax.xml.rpc.namespace.QName qName =
  +                                new javax.xml.rpc.namespace.QName(
  +                                  qNameIn.getNamespaceURI(),
  +                                  qNameIn.getLocalPart());
  +                            Class cls = defaultTM.getClassForQName(qName);
  +                            if (cls == null)
  +                                return null;
  +                            else
  +                                return JavaUtils.getTextClassName(cls.getName());
                           }
  -                        wsdlURI = option.getArgument();
  -                        break;
  +                    };
  +        }
  +    }
   
  -                    case HELP_OPT:
  -                        printUsage();
  -                        break;
  -
  -                    case VERBOSE_OPT:
  -                        emitter.verbose(true);
  -                        break;
  -
  -                    case DEBUG_OPT:
  -                        emitter.debug(true);
  -                        break;
  -                }
  +    private void checkForAuthInfo(String uri) {
  +        URL url = null;
  +        try {
  +            url = new URL(uri);
  +        } catch (MalformedURLException e) {
  +            // not going to have userInfo
  +            return;
  +        }
  +        String userInfo = url.getUserInfo();
  +        if (userInfo != null) {
  +            int i = userInfo.indexOf(':');
  +            if (i >= 0) {
  +                this.username = userInfo.substring(0,i);
  +                this.password = userInfo.substring(i+1);
  +            } else {
  +                this.username = userInfo;
               }
  +        } 
  +    }
   
  -            // validate argument combinations
  -            //
  -            if (wsdlURI == null) {
  -                printUsage();
  +    /**
  +     * This class is used by WSDL2Java main() only
  +     * Supports the http.proxyUser and http.proxyPassword properties.
  +     */
  +    public static class DefaultAuthenticator extends Authenticator {
  +        private String user;
  +        private String password;
  +        
  +        DefaultAuthenticator(String user, String pass) {
  +            this.user = user;
  +            this.password = pass;
  +        }
  +        protected PasswordAuthentication getPasswordAuthentication() {
  +            // if user and password weren't provided, check the system properties
  +            if (user == null) {
  +                user = System.getProperty("http.proxyUser","");
  +            }
  +            if (password == null) {
  +                password = System.getProperty("http.proxyPassword","");
               }
  -            emitter.emit(wsdlURI);
               
  -            // everything is good
  -            System.exit(0);
  +            return new PasswordAuthentication (user, password.toCharArray());
           }
  -        catch (Throwable t) {
  -            t.printStackTrace();
  -            System.exit(1);
  -        }
  -    } // main
  +    }
   
  +    // The remainder are deprecated methods.
  +
  +    /**
  +     * Get the GeneratorFactory.
  +     * @deprecated Call getFactory instead.  This doesn't return
  +     * a WriterFactory, it returns a GeneratorFactory.
  +     */
  +    public GeneratorFactory getWriterFactory() {
  +        return getFactory();
  +    } // getWriterFactory
   
  +    /**
  +     * Call this method if you have a uri for the WSDL document
  +     * @param uri wsdlURI the location of the WSDL file.
  +     * @deprecated Call run(uri) instead.
  +     */
  +    public void emit(String uri) throws IOException, WSDLException {
  +        run(uri);
  +    } // emit
  +
  +    /**
  +     * Call this method if your WSDL document has already been parsed as an XML DOM document.
  +     * @param context context This is directory context for the Document.  If the Document were from file "/x/y/z.wsdl" then the context could be "/x/y" (even "/x/y/z.wsdl" would work).  If context is null, then the context becomes the current directory.
  +     * @param doc doc This is the XML Document containing the WSDL.
  +     * @deprecated Call run(context, doc) instead.
  +     */
  +    public void emit(String context, Document doc) throws IOException, WSDLException {
  +        run(context, doc);
  +    } // emit
  +
  +    /**
  +     * Turn on/off server skeleton creation
  +     * @param value
  +     * @deprecated Use setGenerateServerSide(value)
  +     */
  +    public void generateServerSide(boolean value) {
  +        setGenerateServerSide(value);
  +    }
  +
  +    /**
  +     * Indicate if we should be emitting server side code and deploy/undeploy
  +     * @deprecated Use generateServerSide()
  +     */ 
  +    public boolean getGenerateServerSide() {
  +        return generateServerSide();
  +    }
  +
  +    /**
  +     * Turn on/off server skeleton deploy
  +     * @param value
  +     * @deprecated Use setbDeploySkeleton(value)
  +     */
  +    public void deploySkeleton(boolean value) {
  +        setDeploySkeleton(value);
  +    }
  +
  +    /**
  +     * Indicate if we should be deploying skeleton or implementation
  +     * @deprecated Use bDeploySkeleton()
  +     */ 
  +    public boolean getDeploySkeleton() {
  +        return deploySkeleton();
  +    }
  +
  +    /**
  +     * Turn on/off Helper class generation
  +     * @param value
  +     * @deprecated Use setbHelperGeneration(value)
  +     */
  +    public void setHelperGeneration(boolean value) {
  +        setGenerateHelper(value);
  +    }
  +
  +    /**
  +     * Indicate if we should be generating Helper classes
  +     * @deprecated Use bHelperGeneration()
  +     */ 
  +    public boolean getHelperGeneration() {
  +        return generateHelper();
  +    }
  +
  +    /**
  +     * Turn on/off generation of elements from imported files.
  +     * @param generateImports
  +     * @deprecated Use setImports(generateImports)
  +     */
  +    public void generateImports(boolean generateImports) {
  +        setImports(generateImports);
  +    } // generateImports
  +
  +    /**
  +     * Turn on/off debug messages.
  +     * @param value
  +     * @deprecated Use setDebug(value)
  +     */
  +    public void debug(boolean value) {
  +        setDebug(value);
  +    } // debug
  +
  +    /**
  +     * Return the status of the debug switch.
  +     * @deprecated Use debug()
  +     */
  +    public boolean getDebug() {
  +        return debug();
  +    } // getDebug
  +
  +    /**
  +     * Turn on/off verbose messages
  +     * @param value
  +     * @deprecated Use setVerbose(value)
  +     */
  +    public void verbose(boolean value) {
  +        setVerbose(value);
  +    }
  +
  +    /**
  +     * Return the status of the verbose switch
  +     * @deprecated Use verbose()
  +     */ 
  +    public boolean getVerbose() {
  +        return verbose();
  +    }
  +
  +    /**
  +     * Turn on/off test case creation
  +     * @param value
  +     * @deprecated Use setGenerateTestCase()
  +     */
  +    public void generateTestCase(boolean value) {
  +        setGenerateTestCase(value);
  +    }
  +
  +    /**
  +     * @deprecated Use setbGenerateAll(all)
  +     */
  +     public void generateAll(boolean all) {
  +         setGenerateAll(all);
  +     } // generateAll
   }
  
  
  
  1.7       +10 -4     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
  
  Index: JavaBeanHelperWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JavaBeanHelperWriter.java	9 Apr 2002 15:41:30 -0000	1.6
  +++ JavaBeanHelperWriter.java	9 May 2002 13:14:28 -0000	1.7
  @@ -54,15 +54,21 @@
    */
   package org.apache.axis.wsdl.toJava;
   
  -import org.apache.axis.utils.JavaUtils;
  -import org.w3c.dom.Node;
  -
  -import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
  +
   import java.util.Vector;
   import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
  +
  +import javax.xml.rpc.namespace.QName;
  +
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.axis.wsdl.symbolTable.ElementDecl;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
  +import org.w3c.dom.Node;
   
   /**
    * This is Wsdl2java's Helper Type Writer.  It writes the <typeName>.java file.
  
  
  
  1.12      +11 -6     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java
  
  Index: JavaBeanWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanWriter.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JavaBeanWriter.java	1 May 2002 01:51:10 -0000	1.11
  +++ JavaBeanWriter.java	9 May 2002 13:14:28 -0000	1.12
  @@ -54,12 +54,17 @@
    */
   package org.apache.axis.wsdl.toJava;
   
  -import org.apache.axis.utils.JavaUtils;
  -import org.w3c.dom.Node;
  -
   import java.io.IOException;
  +
   import java.util.Vector;
   
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.axis.wsdl.symbolTable.ElementDecl;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
  +import org.w3c.dom.Node;
  +
   /**
    * This is Wsdl2java's Complex Type Writer.  It writes the <typeName>.java file.
    */
  @@ -269,10 +274,10 @@
   
           // Write the meta data into a Helper class or
           // embed it in the bean class
  -        if (emitter.getHelperGeneration()) {
  -            helper.write(); // separate Helper Class
  +        if (emitter.generateHelper()) {
  +            helper.generate(); // separate Helper Class
           } else {
  -            helper.write(pw); // embed in Bean Class
  +            helper.generate(pw); // embed in Bean Class
           }
           pw.println("}");
           pw.close();
  
  
  
  1.5       +19 -13    xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBindingWriter.java
  
  Index: JavaBindingWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBindingWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JavaBindingWriter.java	5 Mar 2002 14:52:06 -0000	1.4
  +++ JavaBindingWriter.java	9 May 2002 13:14:28 -0000	1.5
  @@ -63,15 +63,21 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.gen.Generator;
  +
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's Binding Writer.  It writes the following files, as appropriate:
   * <bindingName>Stub.java, <bindingName>Skeleton.java, <bindingName>Impl.java.
   */
  -public class JavaBindingWriter implements Writer {
  -    Writer stubWriter = null;
  -    Writer skelWriter = null;
  -    Writer implWriter = null;
  -    Writer interfaceWriter = null;
  +public class JavaBindingWriter implements Generator {
  +    Generator stubWriter = null;
  +    Generator skelWriter = null;
  +    Generator implWriter = null;
  +    Generator interfaceWriter = null;
   
       /**
        * Constructor.
  @@ -96,8 +102,8 @@
               stubWriter = new JavaStubWriter(emitter, bEntry, symbolTable);
   
               // Skeleton and Impl writers
  -            if (emitter.bEmitServer) {
  -                if (emitter.bDeploySkeleton) {
  +            if (emitter.generateServerSide()) {
  +                if (emitter.deploySkeleton()) {
                       skelWriter = new JavaSkelWriter(emitter, bEntry, symbolTable);
                   }
                   String fileName = Utils.getJavaLocalName(bEntry.getName())
  @@ -121,19 +127,19 @@
       /**
        * Write all the binding bindnigs:  stub, skeleton, and impl.
        */
  -    public void write() throws IOException {
  +    public void generate() throws IOException {
           if (interfaceWriter != null) {
  -            interfaceWriter.write();
  +            interfaceWriter.generate();
           }
           if (stubWriter != null) {
  -            stubWriter.write();
  +            stubWriter.generate();
           }
           if (skelWriter != null) {
  -            skelWriter.write();
  +            skelWriter.generate();
           }
           if (implWriter != null) {
  -            implWriter.write();
  +            implWriter.generate();
           }
  -    } // write
  +    } // generate
   
   } // class JavaBindingWriter
  
  
  
  1.7       +16 -6     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDefinitionWriter.java
  
  Index: JavaDefinitionWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDefinitionWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JavaDefinitionWriter.java	1 May 2002 17:17:15 -0000	1.6
  +++ JavaDefinitionWriter.java	9 May 2002 13:14:28 -0000	1.7
  @@ -70,14 +70,20 @@
   import javax.wsdl.PortType;
   import javax.wsdl.QName;
   
  +import org.apache.axis.wsdl.gen.Generator;
  +
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
    * This is Wsdl2java's Definition Writer.  
    * It currently writes the following files:
    *   deploy.xml, undeploy.xml and Faults as needed.
    */
  -public class JavaDefinitionWriter implements Writer {
  +public class JavaDefinitionWriter implements Generator {
  +/*
       protected Writer deployWriter = null;
       protected Writer undeployWriter = null;
  +*/
       protected Emitter emitter;
       protected Definition definition;
       protected SymbolTable symbolTable;
  @@ -87,8 +93,10 @@
        */
       public JavaDefinitionWriter(Emitter emitter, Definition definition,
               SymbolTable symbolTable) {
  +/*
           deployWriter = new JavaDeployWriter(emitter, definition, symbolTable);
           undeployWriter = new JavaUndeployWriter(emitter, definition, symbolTable);
  +*/
           this.emitter = emitter;
           this.definition = definition;
           this.symbolTable = symbolTable;
  @@ -97,13 +105,15 @@
       /**
        * Write other items from the definition as needed.
        */
  -    public void write() throws IOException {
  -        if (emitter.getGenerateServerSide()) {
  +    public void generate() throws IOException {
  +/*
  +        if (emitter.generateServerSide()) {
               deployWriter.write();
               undeployWriter.write();
           }
  +*/
           writeFaults();
  -    } // write
  +    } // generate
   
       /**
        * Write all the faults.
  @@ -120,7 +130,7 @@
               Map.Entry entry = (Map.Entry) fi.next();
               Fault fault = (Fault) entry.getKey();
               QName faultQName = (QName) entry.getValue();
  -            new JavaFaultWriter(emitter, faultQName, fault, symbolTable).write();
  +            new JavaFaultWriter(emitter, faultQName, fault, symbolTable).generate();
           }
       } // writeFaults
   
  @@ -163,7 +173,7 @@
                           Fault f = (Fault) fi.next();
                           String name = Utils.getFullExceptionName(
                                   f,
  -                                symbolTable);
  +                                emitter);
                           // prevent duplicates
                           if (! faultList.contains(name) ) {
                               faultList.add(name);
  
  
  
  1.40      +23 -5     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java
  
  Index: JavaDeployWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDeployWriter.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- JavaDeployWriter.java	9 May 2002 02:09:04 -0000	1.39
  +++ JavaDeployWriter.java	9 May 2002 13:14:28 -0000	1.40
  @@ -72,8 +72,19 @@
   import javax.wsdl.Input;
   
   import org.apache.axis.Constants;
  +
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.CollectionType;
  +import org.apache.axis.wsdl.symbolTable.DefinedElement;
  +import org.apache.axis.wsdl.symbolTable.Element;
  +import org.apache.axis.wsdl.symbolTable.Parameter;
  +import org.apache.axis.wsdl.symbolTable.Parameters;
  +import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
   /**
   * This is Wsdl2java's deploy Writer.  It writes the deploy.java file.
   */
  @@ -84,7 +95,7 @@
       /**
        * Constructor.
        */
  -    protected JavaDeployWriter(Emitter emitter,
  +    public JavaDeployWriter(Emitter emitter,
                                  Definition definition,
                                  SymbolTable symbolTable) {
           super(emitter,
  @@ -96,6 +107,12 @@
           this.symbolTable = symbolTable;
       } // ctor
   
  +    public void generate() throws IOException {
  +        if (emitter.generateServerSide()) {
  +            super.generate();
  +        }
  +    } // generate
  +
       /**
        * Replace the default file header with the deployment doc file header.
        */
  @@ -187,8 +204,8 @@
                       serializerFactory = "org.apache.axis.encoding.ser.ArraySerializerFactory";
                       deserializerFactory = "org.apache.axis.encoding.ser.ArrayDeserializerFactory";
                   } else if (type.getNode() != null &&
  -                   SchemaUtils.getEnumerationBaseAndValues(
  -                     type.getNode(), emitter.getSymbolTable()) != null) {
  +                   Utils.getEnumerationBaseAndValues(
  +                     type.getNode(), symbolTable) != null) {
                       serializerFactory = "org.apache.axis.encoding.ser.EnumSerializerFactory";
                       deserializerFactory = "org.apache.axis.encoding.ser.EnumDeserializerFactory";
                   } else if (type.isSimpleType()) {
  @@ -261,7 +278,7 @@
       protected void writeDeployBinding(Binding binding) throws IOException {
           BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
           String className = bEntry.getName();
  -        if (emitter.getDeploySkeleton())
  +        if (emitter.deploySkeleton())
               className += "Skeleton";
           else
               className += "Impl";
  @@ -270,7 +287,7 @@
                            + className + "\"/>");
   
           String methodList = "";
  -        if (!emitter.getDeploySkeleton()) {
  +        if (!emitter.deploySkeleton()) {
               Iterator operationsIterator = binding.getBindingOperations().iterator();
               for (; operationsIterator.hasNext();) {
                   BindingOperation bindingOper = (BindingOperation) operationsIterator.next();
  @@ -316,6 +333,7 @@
                       // Get the operation's return QName
                       if (params.returnName != null)
                           returnQName = Utils.getWSDLQName(params.returnName);
  +
   
                       // Write the operation metadata
                       writeOperation(javaOperName, elementQName, returnQName,
  
  
  
  1.6       +2 -0      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaEnumTypeWriter.java
  
  Index: JavaEnumTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaEnumTypeWriter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JavaEnumTypeWriter.java	10 Jan 2002 20:08:51 -0000	1.5
  +++ JavaEnumTypeWriter.java	9 May 2002 13:14:28 -0000	1.6
  @@ -60,6 +60,8 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
   import org.w3c.dom.Node;
   
   /**
  
  
  
  1.8       +5 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaFaultWriter.java
  
  Index: JavaFaultWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaFaultWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JavaFaultWriter.java	1 May 2002 17:17:15 -0000	1.7
  +++ JavaFaultWriter.java	9 May 2002 13:14:28 -0000	1.8
  @@ -63,6 +63,9 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.Parameter;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's Fault Writer.  It writes the <faultName>.java file.
   * NOTE:  this must be rewritten.  It doesn't follow JAX-RPC.
  @@ -80,8 +83,8 @@
           // Need to adjust the className and fileName to make sure they are consistent with
           // the full name.  The alternative is to pass a 'dummy' qname into JavaFaultWriter,
           // which is not appropriate.
  -        String fullName = Utils.getFullExceptionName(fault, symbolTable);
  -        className = fullName.substring(fullName.lastIndexOf(".")+1);
  +        String fullName = Utils.getFullExceptionName(fault, emitter);
  +        className = fullName.substring(fullName.lastIndexOf(".") + 1);
           fileName = className + ".java";
   
           this.fault = fault;
  
  
  
  1.8       +4 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaHolderWriter.java
  
  Index: JavaHolderWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaHolderWriter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JavaHolderWriter.java	1 Feb 2002 04:38:18 -0000	1.7
  +++ JavaHolderWriter.java	9 May 2002 13:14:28 -0000	1.8
  @@ -60,6 +60,8 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
   /**
   * This is Wsdl2java's Holder Writer.  It writes the <typeName>Holder.java file.
   */
  @@ -74,8 +76,8 @@
                   emitter,
                   new QName(
                           type.getQName().getNamespaceURI(),
  -                        Utils.holder(type,emitter.getSymbolTable()).substring(
  -                        Utils.holder(type,emitter.getSymbolTable()).lastIndexOf('.')+1)),
  +                        Utils.holder(type, emitter).substring(
  +                        Utils.holder(type, emitter).lastIndexOf('.') + 1)),
                   null,
                   "java",
                   JavaUtils.getMessage("genHolder00"), "holder");
  
  
  
  1.17      +11 -4     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java
  
  Index: JavaImplWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaImplWriter.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JavaImplWriter.java	8 Apr 2002 23:18:45 -0000	1.16
  +++ JavaImplWriter.java	9 May 2002 13:14:28 -0000	1.17
  @@ -75,12 +75,19 @@
   import javax.wsdl.PortType;
   import javax.wsdl.QName;
   
  +import javax.wsdl.extensions.soap.SOAPBody;
  +import javax.wsdl.extensions.soap.SOAPOperation;
  +
   import org.apache.axis.utils.JavaUtils;
   
  -import org.w3c.dom.Node;
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.Parameter;
  +import org.apache.axis.wsdl.symbolTable.Parameters;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
   
  -import javax.wsdl.extensions.soap.SOAPBody;
  -import javax.wsdl.extensions.soap.SOAPOperation;
  +import org.w3c.dom.Node;
   
   /**
   * This is Wsdl2java's implementation template writer.  It writes the <BindingName>Impl.java
  @@ -199,7 +206,7 @@
                                + JavaUtils.replace(paramType, "[]", "[0]"));
                   } else {
                       // We have some constructed type.
  -                    Vector v = SchemaUtils.getEnumerationBaseAndValues(
  +                    Vector v = Utils.getEnumerationBaseAndValues(
                               param.getType().getNode(), symbolTable);
   
                       if (v != null) {
  
  
  
  1.7       +10 -7     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaInterfaceWriter.java
  
  Index: JavaInterfaceWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaInterfaceWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JavaInterfaceWriter.java	14 Feb 2002 14:59:31 -0000	1.6
  +++ JavaInterfaceWriter.java	9 May 2002 13:14:28 -0000	1.7
  @@ -56,8 +56,6 @@
   
   import java.io.IOException;
   
  -import java.util.HashMap;
  -import java.util.HashSet;
   import java.util.Iterator;
   
   import javax.wsdl.Operation;
  @@ -65,6 +63,11 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.Parameters;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's PortType Writer.  It writes the <portTypeName>.java file
   * which contains the <portTypeName> interface.
  @@ -96,17 +99,17 @@
       } // ctor
   
       /**
  -     * Override write method to prevent duplicate interfaces because
  +     * Override generate method to prevent duplicate interfaces because
        * of two bindings referencing the same portType
        */
  -    public void write() throws IOException {
  +    public void generate() throws IOException {
           String fqClass = packageName + "." + className;
   
           // Do not emit the same portType/interface twice
  -        if (!emitter.fileInfo.getClassNames().contains(fqClass)) {
  -             super.write();
  +        if (!emitter.getGeneratedFileInfo().getClassNames().contains(fqClass)) {
  +             super.generate();
           }
  -    } // write
  +    } // generate
   
       /**
        * Write the body of the portType interface file.
  
  
  
  1.3       +6 -8      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceIfaceWriter.java
  
  Index: JavaServiceIfaceWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceIfaceWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaServiceIfaceWriter.java	7 May 2002 16:08:50 -0000	1.2
  +++ JavaServiceIfaceWriter.java	9 May 2002 13:14:28 -0000	1.3
  @@ -56,22 +56,20 @@
   
   import java.io.IOException;
   
  -import java.net.MalformedURLException;
  -import java.net.URL;
  -
   import java.util.Iterator;
  -import java.util.List;
  -import java.util.ListIterator;
   import java.util.Map;
   
   import javax.wsdl.Binding;
   import javax.wsdl.Port;
   import javax.wsdl.Service;
   
  -import javax.wsdl.extensions.soap.SOAPAddress;
  -
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.ServiceEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's service writer.  It writes the <serviceName>.java file.
   */
  @@ -142,7 +140,7 @@
   
               // If there is not literal use, the interface name is the portType name.
               // Otherwise it is the binding name.
  -            String bindingType = (bEntry.hasLiteral()) ?
  +            String bindingType = bEntry.hasLiteral() ?
                       bEntry.getName() : ptEntry.getName();
   
               // Write out the get<PortName> methods
  
  
  
  1.10      +6 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java
  
  Index: JavaServiceImplWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceImplWriter.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JavaServiceImplWriter.java	7 May 2002 16:08:50 -0000	1.9
  +++ JavaServiceImplWriter.java	9 May 2002 13:14:28 -0000	1.10
  @@ -74,6 +74,11 @@
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.XMLUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.ServiceEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's service implementation writer.
   * It writes the <serviceName>Locator.java file.
  @@ -152,7 +157,7 @@
   
               // If there is not literal use, the interface name is the portType name.
               // Otherwise it is the binding name.
  -            String bindingType = (bEntry.hasLiteral()) ?
  +            String bindingType = bEntry.hasLiteral() ?
                       bEntry.getName() : ptEntry.getName();
   
               // getPort(Class) must return a stub for an interface.  Collect all
  
  
  
  1.3       +15 -13    xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceWriter.java
  
  Index: JavaServiceWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaServiceWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaServiceWriter.java	5 Feb 2002 16:22:40 -0000	1.2
  +++ JavaServiceWriter.java	9 May 2002 13:14:28 -0000	1.3
  @@ -56,19 +56,21 @@
   
   import java.io.IOException;
   
  -import java.util.HashMap;
  -
  -import javax.wsdl.QName;
   import javax.wsdl.Service;
   
  +import org.apache.axis.wsdl.gen.Generator;
  +
  +import org.apache.axis.wsdl.symbolTable.ServiceEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's Service Writer.  It writes the following files, as appropriate:
   * <serviceName>.java, <serviceName>TestCase.java.
   */
  -public class JavaServiceWriter implements Writer {
  -    Writer serviceIfaceWriter = null;
  -    Writer serviceImplWriter = null;
  -    Writer testCaseWriter = null;
  +public class JavaServiceWriter implements Generator {
  +    Generator serviceIfaceWriter = null;
  +    Generator serviceImplWriter = null;
  +    Generator testCaseWriter = null;
   
       /**
        * Constructor.
  @@ -83,7 +85,7 @@
                       new JavaServiceIfaceWriter(emitter, sEntry, symbolTable);
               serviceImplWriter =
                       new JavaServiceImplWriter(emitter, sEntry, symbolTable);
  -            if (emitter.bEmitTestCase) {
  +            if (emitter.generateTestCase()) {
                   testCaseWriter =
                           new JavaTestCaseWriter(emitter, sEntry, symbolTable);
               }
  @@ -93,16 +95,16 @@
       /**
        * Write all the service bindnigs:  service and testcase.
        */
  -    public void write() throws IOException {
  +    public void generate() throws IOException {
           if (serviceIfaceWriter != null) {
  -            serviceIfaceWriter.write();
  +            serviceIfaceWriter.generate();
           }
           if (serviceImplWriter != null) {
  -            serviceImplWriter.write();
  +            serviceImplWriter.generate();
           }
           if (testCaseWriter != null) {
  -            testCaseWriter.write();
  +            testCaseWriter.generate();
           }
  -    } // write
  +    } // generate
   
   } // class JavaServiceWriter
  
  
  
  1.23      +8 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java
  
  Index: JavaSkelWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaSkelWriter.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JavaSkelWriter.java	7 May 2002 16:08:50 -0000	1.22
  +++ JavaSkelWriter.java	9 May 2002 13:14:28 -0000	1.23
  @@ -74,6 +74,12 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.Parameter;
  +import org.apache.axis.wsdl.symbolTable.Parameters;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's skeleton writer.  It writes the <BindingName>Skeleton.java
   * file which contains the <bindingName>Skeleton class.
  @@ -107,7 +113,7 @@
   
           // If there is not literal use, the interface name is the portType name.
           // Otherwise it is the binding name.
  -        String portTypeName = (bEntry.hasLiteral()) ?
  +        String portTypeName = bEntry.hasLiteral() ?
                   bEntry.getName () : ptEntry.getName();
           boolean isRPC = true;
           if (bEntry.getBindingStyle() == BindingEntry.STYLE_DOCUMENT) {
  @@ -275,7 +281,7 @@
                       if (obj instanceof SOAPBody) {
                           namespace = ((SOAPBody) obj).getNamespaceURI();
                           if (namespace == null) {
  -                            namespace = emitter.def.getTargetNamespace();
  +                            namespace = symbolTable.getDefinition().getTargetNamespace();
                           }
                           if (namespace == null)
                               namespace = "";
  
  
  
  1.57      +29 -13    xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- JavaStubWriter.java	7 May 2002 16:08:50 -0000	1.56
  +++ JavaStubWriter.java	9 May 2002 13:14:28 -0000	1.57
  @@ -54,8 +54,14 @@
    */
   package org.apache.axis.wsdl.toJava;
   
  -import org.apache.axis.utils.JavaUtils;
  -import org.w3c.dom.Node;
  +import java.io.IOException;
  +
  +import java.util.Collection;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.Vector;
   
   import javax.wsdl.Binding;
   import javax.wsdl.BindingInput;
  @@ -67,15 +73,24 @@
   import javax.wsdl.Part;
   import javax.wsdl.PortType;
   import javax.wsdl.QName;
  +
   import javax.wsdl.extensions.soap.SOAPBody;
   import javax.wsdl.extensions.soap.SOAPOperation;
  -import java.io.IOException;
  -import java.util.Collection;
  -import java.util.HashSet;
  -import java.util.Iterator;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.Vector;
  +
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.CollectionType;
  +import org.apache.axis.wsdl.symbolTable.Element;
  +import org.apache.axis.wsdl.symbolTable.DefinedElement;
  +import org.apache.axis.wsdl.symbolTable.Parameter;
  +import org.apache.axis.wsdl.symbolTable.Parameters;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
  +import org.w3c.dom.Node;
   
   /**
   * This is Wsdl2java's stub writer.  It writes the <BindingName>Stub.java
  @@ -110,7 +125,7 @@
   
           // If there is not literal use, the interface name is the portType name.
           // Otherwise it is the binding name.
  -        String portTypeName = (bEntry.hasLiteral()) ?
  +        String portTypeName = bEntry.hasLiteral() ?
                   bEntry.getName() : ptEntry.getName();
           boolean isRPC = true;
           if (bEntry.getBindingStyle() == BindingEntry.STYLE_DOCUMENT) {
  @@ -262,7 +277,8 @@
                       if (obj instanceof SOAPBody) {
                           namespace = ((SOAPBody) obj).getNamespaceURI();
                           if (namespace == null) {
  -                            namespace = emitter.def.getTargetNamespace();
  +                            namespace = symbolTable.getDefinition().
  +                                    getTargetNamespace();
                           }
                           if (namespace == null)
                               namespace = "";
  @@ -436,8 +452,8 @@
               pw.println("            cachedSerFactories.add(arraysf);");
               pw.println("            cachedDeserFactories.add(arraydf);");
           } else if (type.getNode() != null && 
  -                   SchemaUtils.getEnumerationBaseAndValues(
  -                     type.getNode(), emitter.getSymbolTable()) != null) {
  +                   Utils.getEnumerationBaseAndValues(
  +                     type.getNode(), symbolTable) != null) {
               pw.println("            cachedSerFactories.add(enumsf);");
               pw.println("            cachedDeserFactories.add(enumdf);");
           } else if (type.isSimpleType()) {
  
  
  
  1.24      +12 -5     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java
  
  Index: JavaTestCaseWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTestCaseWriter.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JavaTestCaseWriter.java	7 May 2002 16:08:50 -0000	1.23
  +++ JavaTestCaseWriter.java	9 May 2002 13:14:28 -0000	1.24
  @@ -56,7 +56,6 @@
   
   import java.io.IOException;
   
  -import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Map;
   import java.util.Vector;
  @@ -71,6 +70,14 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.Parameter;
  +import org.apache.axis.wsdl.symbolTable.Parameters;
  +import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  +import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  +import org.apache.axis.wsdl.symbolTable.ServiceEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's TestCase writer.  It writes the <serviceName>TestCase.java file.
   */
  @@ -174,7 +181,7 @@
   
               // If there is not literal use, the interface name is the portType name.
               // Otherwise it is the binding name.
  -            String bindingType = (bEntry.hasLiteral()) ?
  +            String bindingType = bEntry.hasLiteral() ?
                       bEntry.getName() : ptEntry.getName();
               writeBindingAssignment(bindingType, portName);
   
  @@ -220,7 +227,7 @@
                   String suffix = "";
   
                   if (param.getMode() != Parameter.IN) {
  -                    pw.print("new " + Utils.holder(param.getType(), symbolTable)
  +                    pw.print("new " + Utils.holder(param.getType(), emitter)
                               + "(");
                       suffix = ")";
                   }
  @@ -268,7 +275,7 @@
                       } else {
   
                           // We have some constructed type.
  -                        Vector v = SchemaUtils.getEnumerationBaseAndValues(
  +                        Vector v = Utils.getEnumerationBaseAndValues(
                                   param.getType().getNode(), symbolTable);
   
                           if (v != null) {
  @@ -301,7 +308,7 @@
                       Fault f = (Fault) i.next();
                       pw.print("        catch (");
                       pw.print(Utils.getFullExceptionName(
  -                            f, symbolTable));
  +                            f, emitter));
                       pw.println(" e" + count + ") {");
                       pw.print("            ");
                       pw.println("throw new junit.framework.AssertionFailedError(\"" + f.getName() + " Exception caught: \" + e" + count + ");");
  
  
  
  1.11      +18 -9     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTypeWriter.java
  
  Index: JavaTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaTypeWriter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JavaTypeWriter.java	1 May 2002 01:51:10 -0000	1.10
  +++ JavaTypeWriter.java	9 May 2002 13:14:28 -0000	1.11
  @@ -62,15 +62,24 @@
   
   import org.w3c.dom.Node;
   
  +import org.apache.axis.utils.JavaUtils;
  +
  +import org.apache.axis.wsdl.gen.Generator;
  +
  +import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.SymTabEntry;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
   /**
   * This is Wsdl2java's Type Writer.  It writes the following files, as appropriate:
   * <typeName>.java, <typeName>Holder.java.
   */
  -public class JavaTypeWriter implements Writer {
  +public class JavaTypeWriter implements Generator {
       public static final String HOLDER_IS_NEEDED = "Holder is needed";
   
  -    private Writer typeWriter = null;
  -    private Writer holderWriter = null;
  +    private Generator typeWriter = null;
  +    private Generator holderWriter = null;
   
       /**
        * Constructor.
  @@ -89,7 +98,7 @@
               if (!type.getName().endsWith("[]")) {
   
                   // Generate the proper class for either "complex" or "enumeration" types
  -                Vector v = SchemaUtils.getEnumerationBaseAndValues(
  +                Vector v = Utils.getEnumerationBaseAndValues(
                           node, symbolTable);
                   if (v != null) {
                       typeWriter = getEnumTypeWriter(emitter, type, v);
  @@ -129,14 +138,14 @@
       /**
        * Write all the service bindnigs:  service and testcase.
        */
  -    public void write() throws IOException {
  +    public void generate() throws IOException {
           if (typeWriter != null) {
  -            typeWriter.write();
  +            typeWriter.generate();
           }
           if (holderWriter != null) {
  -            holderWriter.write();
  +            holderWriter.generate();
           }
  -    } // write
  +    } // generate
   
       /**
        * Does anything use this type as an inout/out parameter?  Query the Type dynamicVar
  @@ -178,7 +187,7 @@
       /**
        * getHolderWriter
        **/
  -    protected Writer getHolderWriter(Emitter emitter, TypeEntry type) {
  +    protected Generator getHolderWriter(Emitter emitter, TypeEntry type) {
           return new JavaHolderWriter(emitter, type);
       }
   } // class JavaTypeWriter
  
  
  
  1.4       +10 -1     xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaUndeployWriter.java
  
  Index: JavaUndeployWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaUndeployWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavaUndeployWriter.java	5 Mar 2002 14:02:13 -0000	1.3
  +++ JavaUndeployWriter.java	9 May 2002 13:14:28 -0000	1.4
  @@ -67,6 +67,9 @@
   
   import org.apache.axis.utils.JavaUtils;
   
  +import org.apache.axis.wsdl.symbolTable.BindingEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +
   /**
   * This is Wsdl2java's deploy Writer.  It writes the deploy.java file.
   */
  @@ -77,7 +80,7 @@
       /**
        * Constructor.
        */
  -    protected JavaUndeployWriter(Emitter emitter, Definition definition, SymbolTable symbolTable) {
  +    public JavaUndeployWriter(Emitter emitter, Definition definition, SymbolTable symbolTable) {
           super(emitter,
                   new QName(definition.getTargetNamespace(), "undeploy"),
                   "",
  @@ -86,6 +89,12 @@
           this.definition = definition;
           this.symbolTable = symbolTable;
       } // ctor
  +
  +    public void generate() throws IOException {
  +        if (emitter.generateServerSide()) {
  +            super.generate();
  +        }
  +    } // generate
   
       /**
        * Replace the default file header with the deployment doc file header.
  
  
  
  1.11      +17 -12    xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriter.java
  
  Index: JavaWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaWriter.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JavaWriter.java	3 Apr 2002 06:09:55 -0000	1.10
  +++ JavaWriter.java	9 May 2002 13:14:28 -0000	1.11
  @@ -66,6 +66,11 @@
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.Constants;
   
  +import org.apache.axis.wsdl.gen.Generator;
  +
  +import org.apache.axis.wsdl.symbolTable.SymTabEntry;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   
  @@ -91,7 +96,7 @@
   * task of writing to extensions of JavaWriter.
   */
   
  -public abstract class JavaWriter implements Writer {
  +public abstract class JavaWriter implements Generator {
       protected Emitter     emitter;
       protected QName       qname;
       protected Namespaces  namespaces;
  @@ -149,21 +154,21 @@
       /**
        * Generate into an existing class with PrinterWriter pw
        */
  -    public void write(PrintWriter pw) throws IOException {
  +    public void generate(PrintWriter pw) throws IOException {
           embeddedCode = true;  // Indicated embedded
           String packageDirName = namespaces.toDir(packageName);
           String path = packageDirName + fileName;
           String fqClass = packageName + "." + className;
           
           // Check for duplicates, probably the result of namespace mapping
  -        if (emitter.fileInfo.getClassNames().contains(fqClass)) {
  +        if (emitter.getGeneratedClassNames().contains(fqClass)) {
               throw new IOException(JavaUtils.getMessage("duplicateClass00", fqClass));
           }
  -        if (emitter.fileInfo.getFileNames().contains(path)) {
  +        if (emitter.getGeneratedFileNames().contains(path)) {
               throw new IOException(JavaUtils.getMessage("duplicateFile00", path));
           }
           
  -        emitter.fileInfo.add(path, fqClass, type);
  +        emitter.getGeneratedFileInfo().add(path, fqClass, type);
           this.pw = pw;
           writeFileBody();
       }
  @@ -171,29 +176,29 @@
       /**
        * Create the file, write the header, write the body.
        */
  -    public void write() throws IOException {
  +    public void generate() throws IOException {
           String packageDirName = namespaces.toDir(packageName);
           String path = packageDirName + fileName;
           String fqClass = packageName + "." + className;
  -        
  +
           // Check for duplicates, probably the result of namespace mapping
  -        if (emitter.fileInfo.getClassNames().contains(fqClass)) {
  +        if (emitter.getGeneratedClassNames().contains(fqClass)) {
               throw new IOException(JavaUtils.getMessage("duplicateClass00", fqClass));
           }
  -        if (emitter.fileInfo.getFileNames().contains(path)) {
  +        if (emitter.getGeneratedFileNames().contains(path)) {
               throw new IOException(JavaUtils.getMessage("duplicateFile00", path));
           }
           
  -        emitter.fileInfo.add(path, fqClass, type);
  +        emitter.getGeneratedFileInfo().add(path, fqClass, type);
           namespaces.mkdir(packageName);
           File file = new File(packageDirName, fileName);
  -        if (emitter.bVerbose) {
  +        if (emitter.verbose()) {
               System.out.println(message + ":  " + file.getPath());
           }
           pw = new PrintWriter(new FileWriter(file));
           writeFileHeader();
           writeFileBody();
  -    } // write
  +    } // generate
   
       /**
        * Write a common header, including the package name.
  
  
  
  1.29      +184 -606  xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Utils.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- Utils.java	1 May 2002 17:17:15 -0000	1.28
  +++ Utils.java	9 May 2002 13:14:29 -0000	1.29
  @@ -54,443 +54,31 @@
    */
   package org.apache.axis.wsdl.toJava;
   
  -import org.w3c.dom.Node;
  -import org.w3c.dom.NodeList;
  -import org.w3c.dom.NamedNodeMap;
  -
  -import javax.wsdl.QName;
  -import javax.wsdl.Fault;
  -import javax.wsdl.Message;
  -import javax.xml.rpc.holders.BooleanHolder;
  -import javax.xml.rpc.holders.IntHolder;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.util.HashSet;
  +
   import java.util.StringTokenizer;
   import java.util.Vector;
  -import java.util.Iterator;
  -
  -import org.apache.axis.utils.JavaUtils;
  -import org.apache.axis.Constants;      
  -
  -
  -/**
  - * This class contains static utility methods for the emitter.
  - *
  - * @author Rich Scheuerle  (scheu@us.ibm.com)
  - * @author Tom Jordahl (tomj@macromedia.com)
  - */
  -public class Utils {
  -
  -    /**
  -     * Capitalize the first character of the name.
  -     */
  -    public static String capitalizeFirstChar(String name) {
  -        if (name == null || name.equals(""))
  -            return name;
  -        
  -        char start = name.charAt(0);
  -
  -        if (Character.isLowerCase(start)) {
  -            start = Character.toUpperCase(start);
  -            return start + name.substring(1);
  -        }
  -        return name;
  -    } // capitalizeFirstChar
  -
  -    /**
  -     * getNillableQName returns the QName to use if the nillable=true
  -     * attribute is used.                             
  -     * For example:
  -     *   The QName "xsd:int" maps to a java int.
  -     *   However if an element with a type="xsd:int" also has the 
  -     *   "nillable=true" attribute, the type should be an Integer (not an int).
  -     *   So in these circumstances, this routine is called with xsd:int to 
  -     *   get a suitable qname (soapenc:int) which maps to Integer.
  -     * @param QName
  -     */
  -    public static QName getNillableQName(QName qName) {
  -        QName rc = new QName(qName.getNamespaceURI(), qName.getLocalPart());
  -        if (Constants.isSchemaXSD(rc.getNamespaceURI())) {
  -            String localName = rc.getLocalPart();
  -            if (localName.equals("int") ||
  -                localName.equals("long") ||
  -                localName.equals("short") ||
  -                localName.equals("float") ||
  -                localName.equals("double") ||
  -                localName.equals("boolean") ||
  -                localName.equals("byte")) {
  -                rc.setNamespaceURI(Constants.URI_CURRENT_SOAP_ENC);
  -            }
  -            else if (localName.equals("base64Binary") ||
  -                     localName.equals("hexBinary")) {
  -                rc.setNamespaceURI(Constants.URI_CURRENT_SOAP_ENC);
  -                rc.setLocalPart("base64");
  -            }
  -        }
  -       return rc;
  -    }
  -    /**
  -     * Given a node, return the value of the given attribute.
  -     * If the attribute does not exist, searching continues through ancestor nodes until found.
  -     * This method is useful for finding attributes that pertain to a group of contained
  -     * nodes (i.e. xlmns, xmlns:tns, targetNamespace, name)
  -     */
  -    public static String getScopedAttribute(Node node, String attr) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        if (node.getAttributes() == null)
  -            return getScopedAttribute(node.getParentNode(), attr);
  -
  -        Node attrNode = node.getAttributes().getNamedItem(attr);
  -        if (attrNode != null) {
  -            return attrNode.getNodeValue();
  -        }
  -        else {
  -            return getScopedAttribute(node.getParentNode(), attr);
  -        }
  -    }
  -
  -    /**
  -     * Given a node, return the value of the given attribute.
  -     * Returns null if the attribute is not found
  -     */
  -    public static String getAttribute(Node node, String attr) {
  -        if (node == null || node.getAttributes() == null) {
  -            return null;
  -        }
  -
  -        Node attrNode = node.getAttributes().getNamedItem(attr);
  -        if (attrNode != null) {
  -            return attrNode.getNodeValue();
  -        }
  -        else {
  -            return null;
  -        }
  -    }
  -
  -    /**
  -     * Given a node, return the attributes that have the specified local name.
  -     * Returns null if the attribute is not found
  -     */
  -    public static Vector getAttributesWithLocalName(Node node, String localName) {
  -        Vector v = new Vector();
  -        if (node == null) {
  -            return v;
  -        }
  -
  -        NamedNodeMap map = node.getAttributes();
  -        if (map != null) {
  -            for (int i=0; i < map.getLength(); i++) {
  -                Node attrNode =  map.item(i);
  -                if (attrNode != null &&
  -                    attrNode.getLocalName().equals(localName)) {
  -                    v.add(attrNode);
  -                }
  -            }
  -        }
  -        return v;    
  -    }
  -
  -    /**
  -     * An xml element may have a name.
  -     * For example &lt.element name="foo" type="b:bar"&gt.
  -     * has the name "element".  This routine gets the full QName of the element.
  -     */
  -    public static QName getNodeQName(Node node) {
  -        if (node == null) {
  -            return null;
  -        }
  -
  -        String localName = node.getLocalName();
  -        if (localName == null) {
  -            return null;
  -        }
  -        String namespace = node.getNamespaceURI();
  -
  -        return (new QName(namespace, localName));
  -    }
  -
  -    /**
  -     * XML nodes may have a name attribute.
  -     * For example &lt.element name="foo" type="b:bar"&gt.
  -     * has the name attribute value "foo".  This routine gets the QName of the name attribute value.
  -     */
  -    public static QName getNodeNameQName(Node node) {
  -        if (node == null) {
  -            return null;
  -        }
  -        String localName = null;
  -        String namespace = null;
  -
  -        // First try to get the name directly
  -        localName = getAttribute(node, "name");
  -        
  -        // If this fails and the node has a ref, use the ref name.
  -        if (localName == null) {
  -            QName ref = getNodeTypeRefQName(node, "ref");
  -            if (ref != null) {
  -                localName = ref.getLocalPart();
  -                namespace = ref.getNamespaceURI();
  -            }
  -        }
  -        
  -        // This routine may be called for complexType elements.  In some cases,
  -        // the complexType may be anonymous, which is why the getScopedAttribute
  -        // method is used.
  -        if (localName == null) {
  -            localName = "";
  -            Node search = node.getParentNode();
  -            while(search != null) {
  -                QName kind = getNodeQName(search);
  -                if (kind.getLocalPart().equals("schema")) {
  -                    search = null;
  -                } else if (kind.getLocalPart().equals("element") ||
  -                           kind.getLocalPart().equals("attribute")) {
  -                    localName = SymbolTable.ANON_TOKEN +
  -                        getNodeNameQName(search).getLocalPart();
  -                    search = search.getParentNode();
  -                } else if (kind.getLocalPart().equals("complexType") ||
  -                           kind.getLocalPart().equals("simpleType")) {
  -                    localName = getNodeNameQName(search).getLocalPart() + localName;
  -                    search = null;
  -                } else {
  -                    search = search.getParentNode();
  -                }
  -            }            
  -        }
  -        if (localName == null)
  -            return null;
  -
  -        // Build and return the QName
  -        if (namespace == null) {
  -            namespace = getScopedAttribute(node, "targetNamespace");
  -        }
  -        return (new QName(namespace, localName));
  -    }
  -
  -    /**
  -     * XML nodes may have a type/ref attribute.
  -     * For example &lt.element name="foo" type="b:bar"&gt.
  -     * has the type attribute value "b:bar". 
  -     * This routine gets the QName of the type/ref attribute value.
  -     *
  -     * Note: If the "minOccurs" and "maxOccurs" are set such that the 
  -     * type is a collection of "types", then an artificial qname is
  -     * returned to represent the collection.
  -     * 
  -     * If you want the QName for just the "type" without analyzing 
  -     * minOccurs/maxOccurs then use:
  -     *    getNodeTypeRefQName(node, "type")
  -     *
  -     * Note 2: The getNodeTypeRefQName routines also inspect the 
  -     *         "nillable" attribute and may return an alternate QName
  -     *         if nillable is true.  
  -     * 
  -     * @param node of the reference
  -     * @param forElement output parameter is set to true if QName is for an element
  -     *                   (i.e. ref= or element= attribute was used).
  -     * @param QName of type or element (depending on forElement setting)
  -     */
  -    public static QName getNodeTypeRefQName(Node node, BooleanHolder forElement) {
  -        if (node == null) return null;
  -        forElement.value = false; // Assume QName returned is for a type
  -
  -        // If the node has "type" and "maxOccurs" then the type is really
  -        // a collection.  There is no qname in the wsdl which we can use to represent
  -        // the collection, so we need to invent one.
  -        // The local part of the qname is changed to <local>[minOccurs, maxOccurs]
  -        // The namespace uri is changed to the targetNamespace of this node
  -        QName qName= getNodeTypeRefQName(node, "type");
  -        if (qName != null) {
  -            String maxOccursValue = getAttribute(node, "maxOccurs");
  -            String minOccursValue = getAttribute(node, "minOccurs");
  -            if (maxOccursValue == null) {
  -                maxOccursValue = "1";
  -            }
  -            if (minOccursValue == null) {
  -                minOccursValue = "1";
  -            }
  -            if (minOccursValue.equals("0") && maxOccursValue.equals("1")) {
  -                // If we have a minoccurs="0"/maxoccurs="1", this is just
  -                // like a nillable single value, so treat it as such.
  -                qName = getNillableQName(qName);
  -            } else if (!maxOccursValue.equals("1") || !minOccursValue.equals("1")) {
  -                String localPart = qName.getLocalPart();
  -//                localPart += "[" + minOccursValue + "," + maxOccursValue + "]";
  -//                qName.setLocalPart(localPart);
  -//                String namespace = getScopedAttribute(node, "targetNamespace");
  -//                if (namespace != null)
  -//                    qName.setNamespaceURI(namespace);
  -                localPart += "[" + maxOccursValue + "]";
  -                qName.setLocalPart(localPart);
  -            }
  -        }
  -
  -        // Both "ref" and "element" reference elements
  -        if (qName == null) {
  -            forElement.value = true;
  -            qName = getNodeTypeRefQName(node, "ref");
  -        }
  -        // A WSDL Part uses the element attribute instead of the ref attribute
  -        if (qName == null) {
  -            forElement.value = true;
  -            qName = getNodeTypeRefQName(node, "element");
  -        }
  -
  -        // "base" references a "type"
  -        if (qName == null) {
  -            forElement.value = false;
  -            qName = getNodeTypeRefQName(node, "base");
  -        }
  -        return qName;
  -    }
  -
  -    /**
  -     * Obtain the QName of the type/ref using the indicated attribute name.
  -     * For example, the "type" attribute in an XML enumeration struct is the 
  -     * "base" attribute. 
  -     * If the "type" attribute is requested, the "nillable" attribute is 
  -     * also inspected to see if an alternate qname should be returned.
  -     *
  -     * @param node in the dom
  -     * @param typeAttrName (type, base, element, ref)
  -     */
  -    public static QName getNodeTypeRefQName(Node node, String typeAttrName) {
  -        if (node == null) {
  -            return null;
  -        }
  -        String prefixedName = getAttribute(node, typeAttrName);
  -
  -        // The type attribute defaults to xsd:anyType if there
  -        // are no other conflicting attributes and no anonymous type.
  -        if (prefixedName == null &&
  -            typeAttrName.equals("type")) {
  -            if (getAttribute(node, "ref") == null &&
  -                getAttribute(node, "base") == null && 
  -                getAttribute(node, "element") == null &&
  -                SchemaUtils.getElementAnonQName(node) == null) {
  -                QName nodeName = getNodeQName(node);
  -                if (nodeName != null &&
  -                    Constants.isSchemaXSD(nodeName.getNamespaceURI()) &&
  -                    (nodeName.getLocalPart().equals("element") ||
  -                     nodeName.getLocalPart().equals("attribute"))) {
  -                    return getWSDLQName(Constants.XSD_ANYTYPE);
  -                }
  -            }              
  -        }
  -         
  -        // Return null if not found
  -        if (prefixedName == null) {
  -            return null;
  -        }
  -        // Change the prefixed name into a full qname
  -        QName qName = getQNameFromPrefixedName(node,prefixedName);
  -
  -        // An alternate qname is returned if nillable
  -        if (typeAttrName.equals("type")) {
  -            String nillable = getAttribute(node, "nillable");
  -            if (nillable != null && nillable.equalsIgnoreCase("true")) {
  -                qName = getNillableQName(qName);
  -            }
  -        }
  -        return qName;
  -    }
  -
  -    /**
  -     * Convert a prefixed name into a qname
  -     */
  -    public static QName getQNameFromPrefixedName(Node node, String prefixedName) {
  - 
  -        String localName = prefixedName.substring(prefixedName.lastIndexOf(":")+1);
  -        String namespace = null;
  -        // Associate the namespace prefix with a namespace
  -        if (prefixedName.length() == localName.length()) {
  -           namespace = getScopedAttribute(node, "xmlns");  // Get namespace for unqualified reference
  -        }
  -        else {
  -           namespace = getScopedAttribute(node, "xmlns:" + prefixedName.substring(0, prefixedName.lastIndexOf(":")));
  -        }
  -        return (new QName(namespace, localName));
  -    }
  -
  -    /**
  -     * Map an XML name to a valid Java identifier
  -     */
  -    public static String xmlNameToJava(String name)
  -    {
  -        // NOTE:  This method should really go away and all callers should call
  -        // JavaUtils.xmlNameToJava directly.  But there are a lot of them and I wanted
  -        // to keep the changes to a minimum.  Besides, these are static methods so the should
  -        // be inlined.
  -        return JavaUtils.xmlNameToJava(name);
  -    }
  -
  -    /**
  -     * Map an XML name to a valid Java identifier w/ capitolized first letter 
  -     */ 
  -    public static String xmlNameToJavaClass(String name)
  -    {
  -        return capitalizeFirstChar(xmlNameToJava(name));
  -    }
  -
  -    public static String makePackageName(String namespace)
  -    {
  -        String hostname = null;
  -
  -        // get the target namespace of the document
  -        try {
  -            hostname = new URL(namespace).getHost();
  -        }
  -        catch (MalformedURLException e) {
  -            if (namespace.indexOf(":") > -1) {
  -                hostname = namespace.substring(namespace.indexOf(":") + 1);
  -                if (hostname.indexOf("/") > -1)
  -                    hostname = hostname.substring(0, hostname.indexOf("/") );
  -            }
  -            else {
  -                hostname = namespace;
  -            }
  -        }
   
  -        // if we didn't file a hostname, bail
  -        if (hostname == null) {
  -            return null;
  -        }
  +import javax.wsdl.Fault;
  +import javax.wsdl.Message;
  +import javax.wsdl.QName;
   
  -        //convert illegal java identifier
  -        hostname = hostname.replace('-', '_');
  +import org.apache.axis.Constants;
   
  -        // tokenize the hostname and reverse it
  -        StringTokenizer st = new StringTokenizer( hostname, "." );
  -        String[] words = new String[ st.countTokens() ];
  -        for(int i = 0; i < words.length; ++i)
  -            words[i] = st.nextToken();
  +import org.apache.axis.utils.JavaUtils;
   
  -        StringBuffer sb = new StringBuffer(80);
  -        for(int i = words.length-1; i >= 0; --i) {
  -            String word = words[i];
  -            if (JavaUtils.isJavaKeyword(word)) {
  -                word = JavaUtils.makeNonJavaKeyword(word);
  -            }
  -            // seperate with dot
  -            if( i != words.length-1 )
  -                sb.append('.');
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
  +import org.apache.axis.wsdl.symbolTable.TypeEntry;
   
  -            // convert digits to underscores
  -            if( Character.isDigit(word.charAt(0)) )
  -                sb.append('_');
  -            sb.append( word );
  -        }
  -        return sb.toString();
  -    }
  +import org.w3c.dom.Node;
  +import org.w3c.dom.NodeList;
   
  +public class Utils extends org.apache.axis.wsdl.symbolTable.Utils {
       /**
        * Given a type, return the Java mapping of that type's holder.
        */
  -    public static String holder(TypeEntry type, SymbolTable symbolTable) {
  +    public static String holder(TypeEntry type, Emitter emitter) {
           String typeValue = type.getName();
   
           // byte[] and Byte[] have reserved holders
  @@ -502,7 +90,7 @@
           }
           // Anything else with [] gets its holder from the qname
           else if (typeValue.endsWith("[]")) {
  -            String name = symbolTable.getJavaName(type.getQName());
  +            String name = emitter.getJavaName(type.getQName());
               // This could be a special QName for a indexed property.
               // If so, change the [] to Array.
               name = JavaUtils.replace(name, "[]", "Array");
  @@ -565,172 +153,211 @@
               return typeValue + "Holder";
       } // holder
   
  -
       /**
  -     * Given a fault, return the fully qualified Java class name 
  -     * of the exception to be
  -     * generated from this fault
  +     * Given a fault, return the fully qualified Java class name
  +     * of the exception to be generated from this fault
        * 
        * @param fault - The WSDL fault object
        * @param symbolTable - the symbol table
        * @return A Java class name for the fault
        */ 
       public static String getFullExceptionName(
  -            Fault fault, SymbolTable symbolTable) {
  +            Fault fault, Emitter emitter) {
   
           // Upgraded to JSR 101 version 0.8
   
  -        // Get the Message referenced in the message attribute of the 
  +        // Get the Message referenced in the message attribute of the
           // fault.
           Message faultMessage = fault.getMessage();
  -        return symbolTable.getJavaName(faultMessage.getQName());
  +        return emitter.getJavaName(faultMessage.getQName());
       } // getFullExceptionName
   
  -
       /**
  -     * This method returns a set of all types that are derived
  -     * from this type via an extension of a complexType
  +     * If the specified node represents a supported JAX-RPC enumeration,
  +     * a Vector is returned which contains the base type and the enumeration values.
  +     * The first element in the vector is the base type (an TypeEntry).
  +     * Subsequent elements are values (Strings).
  +     * If this is not an enumeration, null is returned.
        */
  -    public static HashSet getDerivedTypes(TypeEntry type, SymbolTable symbolTable) {
  -        HashSet types = new HashSet();
  -        if (type != null && type.getNode() != null) {
  -            getDerivedTypes(type, types, symbolTable);
  -        } else if (Constants.isSchemaXSD(type.getQName().getNamespaceURI()) &&
  -                   type.getQName().getLocalPart().equals("anyType")) {
  -            // All types are derived from anyType
  -            types.addAll(symbolTable.getTypes());
  -        }
  -        return types;
  -    } // getNestedTypes
  -
  -    private static void getDerivedTypes(
  -            TypeEntry type, HashSet types, SymbolTable symbolTable) {
  -
  -        // If all types are in the set, return
  -        if (types.size() == symbolTable.getTypes().size()) {
  -            return;
  -        }
  -
  -        // Search the dictionary for derived types of type
  -        Vector allTypes = symbolTable.getTypes();
  -        Iterator it = allTypes.iterator();
  -        while(it.hasNext()) {
  -            TypeEntry derivedType = (TypeEntry) it.next();
  -            if (derivedType instanceof DefinedType &&
  -                derivedType.getNode() != null &&
  -                !types.contains(derivedType) &&
  -                SchemaUtils.getComplexElementExtensionBase(
  -                   derivedType.getNode(),
  -                   symbolTable) == type) {
  -                types.add(derivedType);
  -                getDerivedTypes(derivedType, types, symbolTable);
  -            }
  +    public static Vector getEnumerationBaseAndValues(Node node, SymbolTable symbolTable) {
  +        if (node == null) {
  +            return null;
           }
  -    } // getDerivedTypes
   
  -    /**
  -     * This method returns a set of all the nested types.
  -     * Nested types are types declared within this TypeEntry (or descendents)
  -     * plus any extended types and the extended type nested types
  -     * The elements of the returned HashSet are Types.
  -     * @param type is the type entry to consider
  -     * @param symbolTable is the symbolTable
  -     * @param derivedFlag should be set if all dependendent derived types should also be 
  -     * returned.
  -     */
  -    public static HashSet getNestedTypes(TypeEntry type, SymbolTable symbolTable, 
  -                                         boolean derivedFlag) {
  -        HashSet types = new HashSet();
  -        getNestedTypes(type, types, symbolTable, derivedFlag);
  -        return types;
  -    } // getNestedTypes
  -
  -    private static void getNestedTypes(
  -            TypeEntry type, HashSet types, SymbolTable symbolTable, 
  -            boolean derivedFlag) {
  -
  -        if (type == null) {
  -            return;
  -        }
  -        
  -        // If all types are in the set, return
  -        if (types.size() == symbolTable.getTypes().size()) {
  -            return;
  -        }
  -        
  -        // Process types derived from this type
  -        if (derivedFlag) {
  -            HashSet derivedTypes = getDerivedTypes(type, symbolTable);
  -            Iterator it = derivedTypes.iterator();
  -            while(it.hasNext()) {
  -                TypeEntry derivedType = (TypeEntry) it.next();
  -                if (!types.contains(derivedType)) {
  -                    types.add(derivedType);
  -                    getNestedTypes(derivedType, types, symbolTable, derivedFlag);
  +        // If the node kind is an element, dive into it.
  +        QName nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("element") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +            NodeList children = node.getChildNodes();
  +            Node simpleNode = null;
  +            for (int j = 0; j < children.getLength() && simpleNode == null; j++) {
  +                QName simpleKind = Utils.getNodeQName(children.item(j));
  +                if (simpleKind != null &&
  +                    simpleKind.getLocalPart().equals("simpleType") &&
  +                    Constants.isSchemaXSD(simpleKind.getNamespaceURI())) {
  +                    simpleNode = children.item(j);
  +                    node = simpleNode;
                   }
               }
           }
  -        
  -        // Continue only if the node exists
  -        if(type.getNode() == null) {
  -            return;
  -        }
  -        Node node = type.getNode();
  -
  -        // Process types declared in this type
  -        Vector v = SchemaUtils.getContainedElementDeclarations(node, symbolTable);
  -        if (v != null) {
  -            for (int i = 0; i < v.size(); i++) {
  -                ElementDecl elem = (ElementDecl)v.get(i);
  -                if (!types.contains(elem.getType())) {
  -                    types.add(elem.getType());
  -                    getNestedTypes(elem.getType(), 
  -                                   types, 
  -                                   symbolTable, derivedFlag);
  +        // Get the node kind, expecting a schema simpleType
  +        nodeKind = Utils.getNodeQName(node);
  +        if (nodeKind != null &&
  +            nodeKind.getLocalPart().equals("simpleType") &&
  +            Constants.isSchemaXSD(nodeKind.getNamespaceURI())) {
  +
  +            // Under the simpleType there should be a restriction.
  +            // (There may be other #text nodes, which we will ignore).
  +            NodeList children = node.getChildNodes();
  +            Node restrictionNode = null;
  +            for (int j = 0; j < children.getLength() && restrictionNode == null; j++) {
  +                QName restrictionKind = Utils.getNodeQName(children.item(j));
  +                if (restrictionKind != null &&
  +                    restrictionKind.getLocalPart().equals("restriction") &&
  +                    Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
  +                    restrictionNode = children.item(j);
  +            }
  +
  +            // The restriction node indicates the type being restricted
  +            // (the base attribute contains this type).
  +            // The base type must be a built-in type, and not boolean
  +            TypeEntry baseEType = null;
  +            if (restrictionNode != null) {
  +                QName baseType = Utils.getNodeTypeRefQName(restrictionNode, "base");
  +                baseEType = symbolTable.getType(baseType);
  +                if (baseEType != null) {
  +                    String javaName = baseEType.getName();
  +                    if (javaName.equals("java.lang.String") ||
  +                        javaName.equals("int") ||
  +                        javaName.equals("long") ||
  +                        javaName.equals("short") ||
  +                        javaName.equals("float") ||
  +                        javaName.equals("double") ||
  +                        javaName.equals("byte"))
  +                        ; // Okay Type
  +                    else
  +                        baseEType = null;
                   }
               }
  -        }
   
  -        // Process attributes declared in this type
  -        v = SchemaUtils.getContainedAttributeTypes(node, symbolTable);
  -        if (v != null) {
  -            for (int i = 0; i < v.size(); i+=2) {
  -                if (!types.contains(v.get(i))) {
  -                    types.add(v.get(i));
  -                    getNestedTypes(
  -                            ((TypeEntry) v.get(i)), types, symbolTable, derivedFlag);
  +            // Process the enumeration elements underneath the restriction node
  +            if (baseEType != null && restrictionNode != null) {
  +
  +                Vector v = new Vector();                
  +                NodeList enums = restrictionNode.getChildNodes();
  +                for (int i=0; i < enums.getLength(); i++) {
  +                    QName enumKind = Utils.getNodeQName(enums.item(i));
  +                    if (enumKind != null &&
  +                        enumKind.getLocalPart().equals("enumeration") &&
  +                        Constants.isSchemaXSD(enumKind.getNamespaceURI())) {
  +
  +                        // Put the enum value in the vector.
  +                        Node enumNode = enums.item(i);
  +                        String value = Utils.getAttribute(enumNode, "value");
  +                        if (value != null) {
  +                            v.add(value);
  +                        }
  +                    }
                   }
  +                
  +                // is this really an enumeration?
  +                if(v.isEmpty()) return null;
  +                
  +                // The first element in the vector is the base type (an TypeEntry).
  +                v.add(0,baseEType);
  +                return v;
               }
           }
  +        return null;
  +    }
  +
  +    /**
  +     * Capitalize the first character of the name.
  +     */
  +    public static String capitalizeFirstChar(String name) {
  +        if (name == null || name.equals(""))
  +            return name;
           
  -        // Get the anonymous type of the element
  -        QName anonQName = SchemaUtils.getElementAnonQName(node);
  -        if (anonQName != null) {
  -            TypeEntry anonType = symbolTable.getType(anonQName);
  -            if (anonType != null && !types.contains(anonType)) {
  -                types.add(anonType);
  -            }
  +        char start = name.charAt(0);
  +
  +        if (Character.isLowerCase(start)) {
  +            start = Character.toUpperCase(start);
  +            return start + name.substring(1);
           }
  +        return name;
  +    } // capitalizeFirstChar
   
  -        // Process extended types
  -        TypeEntry extendType = SchemaUtils.getComplexElementExtensionBase(node, symbolTable);
  -        if (extendType != null) {
  -            if (!types.contains(extendType)) {
  -                types.add(extendType);
  -                getNestedTypes(extendType, types, symbolTable, derivedFlag);
  +    /**
  +     * Map an XML name to a valid Java identifier
  +     */
  +    public static String xmlNameToJava(String name)
  +    {
  +        // NOTE:  This method should really go away and all callers should call
  +        // JavaUtils.xmlNameToJava directly.  But there are a lot of them and I wanted
  +        // to keep the changes to a minimum.  Besides, these are static methods so the should
  +        // be inlined.
  +        return JavaUtils.xmlNameToJava(name);
  +    }
  +
  +    /**
  +     * Map an XML name to a valid Java identifier w/ capitolized first letter 
  +     */ 
  +    public static String xmlNameToJavaClass(String name)
  +    {
  +        return capitalizeFirstChar(xmlNameToJava(name));
  +    }
  +
  +    public static String makePackageName(String namespace)
  +    {
  +        String hostname = null;
  +
  +        // get the target namespace of the document
  +        try {
  +            hostname = new URL(namespace).getHost();
  +        }
  +        catch (MalformedURLException e) {
  +            if (namespace.indexOf(":") > -1) {
  +                hostname = namespace.substring(namespace.indexOf(":") + 1);
  +                if (hostname.indexOf("/") > -1)
  +                    hostname = hostname.substring(0, hostname.indexOf("/") );
               }
  +            else {
  +                hostname = namespace;
  +            }
  +        }
  +
  +        // if we didn't file a hostname, bail
  +        if (hostname == null) {
  +            return null;
           }
   
  -        // Process array element types
  -        QName elementQName = SchemaUtils.getArrayElementQName(node, new IntHolder(0));
  -        TypeEntry elementType = symbolTable.getType(elementQName);
  -        if (elementType != null) {
  -            if (!types.contains(elementType)) {
  -                types.add(elementType);
  -                getNestedTypes(elementType, types, symbolTable, derivedFlag);
  +        //convert illegal java identifier
  +        hostname = hostname.replace('-', '_');
  +
  +        // tokenize the hostname and reverse it
  +        StringTokenizer st = new StringTokenizer( hostname, "." );
  +        String[] words = new String[ st.countTokens() ];
  +        for(int i = 0; i < words.length; ++i)
  +            words[i] = st.nextToken();
  +
  +        StringBuffer sb = new StringBuffer(80);
  +        for(int i = words.length-1; i >= 0; --i) {
  +            String word = words[i];
  +            if (JavaUtils.isJavaKeyword(word)) {
  +                word = JavaUtils.makeNonJavaKeyword(word);
               }
  +            // seperate with dot
  +            if( i != words.length-1 )
  +                sb.append('.');
  +
  +            // convert digits to underscores
  +            if( Character.isDigit(word.charAt(0)) )
  +                sb.append('_');
  +            sb.append( word );
           }
  -    } // getNestedTypes
  +        return sb.toString();
  +    }
   
       /**
        * Query Java Local Name
  @@ -751,53 +378,4 @@
           }
       } // getJavaPackageName
   
  -    /**
  -     * Common code for generating a QName in emitted code.  Note that there's
  -     * no semicolon at the end, so we can use this in a variety of contexts.
  -     */ 
  -    public static String getNewQName(javax.xml.rpc.namespace.QName qname)
  -    {
  -        return "new javax.xml.rpc.namespace.QName(\"" +
  -                qname.getNamespaceURI() + "\", \"" +
  -                qname.getLocalPart() + "\")";
  -    }
  -    
  -    public static javax.xml.rpc.namespace.QName getAxisQName(QName qname)
  -    {
  -        if (qname == null) {
  -            return null;
  -        }
  -        return new javax.xml.rpc.namespace.QName(qname.getNamespaceURI(),
  -                                                 qname.getLocalPart());
  -    }
  -    
  -    public static QName getWSDLQName(javax.xml.rpc.namespace.QName qname)
  -    {
  -        if (qname == null) {
  -            return null;
  -        }
  -        return new QName(qname.getNamespaceURI(), qname.getLocalPart());
  -    }
  -    
  -    /**
  -     * Generate an XML prefixed attribute value with a corresponding xmlns 
  -     * declaration for the prefix.  If there is no namespace, 
  -     * don't prefix the name or emit the xmlns attribute.
  -     * 
  -     * Caller should provide the enclosing quotes.
  -     * 
  -     * Usage:  println("name=\"" + genXMLQNameString(qname, "foo") + "\""
  -     */ 
  -    public static String genQNameAttributeString(QName qname, String prefix) {
  -        String result;
  -        if (qname.getNamespaceURI() == null || qname.getNamespaceURI().equals(""))
  -            return qname.getLocalPart();
  -        
  -        return prefix + ":" + qname.getLocalPart() + "\" xmlns:" + prefix +
  -                "=\"" + qname.getNamespaceURI();
  -    }
  -}
  -
  -
  -
  -
  +} // class Utils
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.axis.wsdl.toJava;
  
  import java.lang.reflect.Constructor;
  
  import java.io.IOException;
  
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Vector;
  
  import javax.wsdl.Binding;
  import javax.wsdl.Definition;
  import javax.wsdl.Fault;
  import javax.wsdl.Message;
  import javax.wsdl.Operation;
  import javax.wsdl.OperationType;
  import javax.wsdl.PortType;
  import javax.wsdl.QName;
  import javax.wsdl.Service;
  
  import org.apache.axis.encoding.TypeMapping;
  import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
  
  import org.apache.axis.utils.JavaUtils;
  
  import org.apache.axis.wsdl.gen.NoopGenerator;
  import org.apache.axis.wsdl.gen.Generator;
  import org.apache.axis.wsdl.gen.GeneratorFactory;
  
  import org.apache.axis.wsdl.symbolTable.BaseTypeMapping;
  import org.apache.axis.wsdl.symbolTable.BindingEntry;
  import org.apache.axis.wsdl.symbolTable.DefinedElement;
  import org.apache.axis.wsdl.symbolTable.Element;
  import org.apache.axis.wsdl.symbolTable.MessageEntry;
  import org.apache.axis.wsdl.symbolTable.Parameter;
  import org.apache.axis.wsdl.symbolTable.Parameters;
  import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
  import org.apache.axis.wsdl.symbolTable.ServiceEntry;
  import org.apache.axis.wsdl.symbolTable.SchemaUtils;
  import org.apache.axis.wsdl.symbolTable.SymbolTable;
  import org.apache.axis.wsdl.symbolTable.SymTabEntry;
  import org.apache.axis.wsdl.symbolTable.Type;
  import org.apache.axis.wsdl.symbolTable.TypeEntry;
  
  /**
  * This is Wsdl2java's implementation of the GeneratorFactory
  */
  
  public class JavaGeneratorFactory implements GeneratorFactory {
      protected Emitter     emitter;
      protected SymbolTable symbolTable;
  
      /**
       * Default constructor.  Note that this class is unusable until setEmitter
       * is called.
       */
  
      public JavaGeneratorFactory() {
      } // ctor
  
      public JavaGeneratorFactory(Emitter emitter) {
          this.emitter = emitter;
      } // ctor
  
      public void setEmitter(Emitter emitter) {
          this.emitter = emitter;
      } // setEmitter
  
      /**
       * Do the Wsdl2java generator pass:
       * - resolve name clashes
       * - construct signatures
       */
      public void generatorPass(Definition def, SymbolTable symbolTable) {
          this.symbolTable = symbolTable;
          javifyNames(symbolTable);
          resolveNameClashes(symbolTable);
          if (emitter.generateAll()) {
              setAllReferencesToTrue();
          }
          else {
              ignoreNonSOAPBindings(symbolTable);
          }
          constructSignatures(symbolTable);
          determineIfHoldersNeeded(symbolTable);
      } // generatorPass
  
      /**
       * Since Wsdl2java doesn't emit anything for Messages, return the No-op generator.
       */
      private Writers messageWriters = new Writers();
  
      public Generator getGenerator(Message message, SymbolTable symbolTable) {
          MessageEntry mEntry = symbolTable.getMessageEntry(message.getQName());
          messageWriters.addStuff(new NoopGenerator(), mEntry, symbolTable);
          return messageWriters;
      } // getGenerator
  
      /**
       * Return Wsdl2java's JavaPortTypeWriter object.
       */
      private Writers portTypeWriters = new Writers();
  
      public Generator getGenerator(PortType portType, SymbolTable symbolTable) {
          PortTypeEntry ptEntry = symbolTable.getPortTypeEntry(portType.getQName());
          portTypeWriters.addStuff(new NoopGenerator(), ptEntry, symbolTable);
          return portTypeWriters;
      } // getGenerator
  
      /**
       * Return Wsdl2java's JavaBindingWriter object.
       */
      private Writers bindingWriters = new Writers();
  
      public Generator getGenerator(Binding binding, SymbolTable symbolTable) {
          Generator writer = new JavaBindingWriter(emitter, binding, symbolTable);
          BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName());
          bindingWriters.addStuff(writer, bEntry, symbolTable);
          return bindingWriters;
      } // getGenerator
  
      /**
       * Return Wsdl2java's JavaServiceWriter object.
       */
      private Writers serviceWriters = new Writers();
  
      public Generator getGenerator(Service service, SymbolTable symbolTable) {
          Generator writer = new JavaServiceWriter(emitter, service, symbolTable);
          ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName());
          serviceWriters.addStuff(writer, sEntry, symbolTable);
          return serviceWriters;
      } // getGenerator
  
      /**
       * Return Wsdl2java's JavaTypeWriter object.
       */
      private Writers typeWriters = new Writers();
  
      public Generator getGenerator(TypeEntry type, SymbolTable symbolTable) {
          Generator writer = new JavaTypeWriter(emitter, type, symbolTable);
          typeWriters.addStuff(writer, type, symbolTable);
          return typeWriters;
      } // getGenerator
  
      /**
       * Return Wsdl2java's JavaDefinitionWriter object.
       */
      private Writers defWriters = new Writers();
  
      public Generator getGenerator(Definition definition, SymbolTable symbolTable) {
          defWriters.addStuff(null, definition, symbolTable);
          return defWriters;
      } // getGenerator
  
      // Hack class just to play with the idea of adding writers
      class Writers implements Generator {
          Vector writers = new Vector();
          SymbolTable symbolTable = null;
          Generator baseWriter = null;
  
          // entry or def, but not both, will be a parameter.
          SymTabEntry entry = null;
          Definition def = null;
  
          public void addGenerator(Class writer) {
              writers.add(writer);
          } // addWriter
  
          public void addStuff(Generator baseWriter, SymTabEntry entry, SymbolTable symbolTable) {
              this.baseWriter = baseWriter;
              this.entry = entry;
              this.symbolTable = symbolTable;
          } // addStuff
  
          public void addStuff(Generator baseWriter, Definition def, SymbolTable symbolTable) {
              this.baseWriter = baseWriter;
              this.def = def;
              this.symbolTable = symbolTable;
          } // addStuff
  
          public void generate() throws IOException {
              if (baseWriter != null) {
                  baseWriter.generate();
              }
              Class[] formalArgs = null;
              Object[] actualArgs = null;
              if (entry != null) {
                  formalArgs = new Class[] {Emitter.class, entry.getClass(), SymbolTable.class};
                  actualArgs = new Object[] {emitter, entry, symbolTable};
              }
              else {
                  formalArgs = new Class[] {Emitter.class, Definition.class, SymbolTable.class};
                  actualArgs = new Object[] {emitter, def, symbolTable};
              }
              for (int i = 0; i < writers.size(); ++i) {
                  Class wClass = (Class) writers.get(i);
                  Generator gen = null;
                  try {
                      Constructor ctor = wClass.getConstructor(formalArgs);
                      gen = (Generator) ctor.newInstance(actualArgs);
                  }
                  catch (Throwable t) {
                      throw new IOException();
                  }
                  gen.generate();
              }
          } // generate
      } // class Writers
  
      public void addGenerator(Class wsdlClass, Class generator) {
          // This is just a hack right now... it just works with Service
          if (Message.class.isAssignableFrom(wsdlClass)) {
              messageWriters.addGenerator(generator);
          }
          else if (PortType.class.isAssignableFrom(wsdlClass)) {
              portTypeWriters.addGenerator(generator);
          }
          else if (Binding.class.isAssignableFrom(wsdlClass)) {
              bindingWriters.addGenerator(generator);
          }
          else if (Service.class.isAssignableFrom(wsdlClass)) {
              serviceWriters.addGenerator(generator);
          }
          else if (TypeEntry.class.isAssignableFrom(wsdlClass)) {
              typeWriters.addGenerator(generator);
          }
          else if (Definition.class.isAssignableFrom(wsdlClass)) {
              defWriters.addGenerator(generator);
          }
      } // addGenerator
  
      /**
       * Fill in the names of each SymTabEntry with the javaified name.
       * Note: This method also ensures that anonymous types are 
       * given unique java type names.
       */
      private void javifyNames(SymbolTable symbolTable) {
          int uniqueNum = 0;
          HashMap anonQNames = new HashMap();
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  SymTabEntry entry = (SymTabEntry) v.elementAt(i);
  
                  // Use the type or the referenced type's QName to generate the java name.      
                  if (entry instanceof TypeEntry) {
                      TypeEntry tEntry = (TypeEntry) entry;
                      String dims = tEntry.getDimensions();
                      TypeEntry refType = tEntry.getRefType();
                      while (refType != null) {
                          tEntry = refType;
                          dims += tEntry.getDimensions();
                          refType = tEntry.getRefType();
                      }
                      
                      // Get the QName to javify
                      QName typeQName = tEntry.getQName();
                      if ((typeQName.getLocalPart().indexOf(SymbolTable.ANON_TOKEN) >= 0) &&
                              (tEntry.getName() == null)) {
                          // This is an anonymous type name.
                          // Axis uses '>' as a nesting token to generate
                          // unique qnames for anonymous types.
                          // Only consider the localName after the last '>' when
                          // generating the java name
                          String localName = typeQName.getLocalPart();
                          localName = 
                              localName.substring(
                                  localName.lastIndexOf(SymbolTable.ANON_TOKEN)+1);
                          typeQName = new QName(typeQName.getNamespaceURI(), localName);
                          // If there is already an existing type, there will be a 
                          // collision.  If there is an existing anon type, there will be a 
                          // collision.  In both cases, the java type name should be mangled.
                          TypeEntry existing = symbolTable.getType(typeQName);
                          if (anonQNames.get(typeQName) != null ||
                                  (existing != null && 
                                  !(existing instanceof DefinedElement))) {
                              localName += "Type" + uniqueNum++;
                              typeQName = new QName(typeQName.getNamespaceURI(), localName);
                          } 
                          anonQNames.put(typeQName, typeQName);
                          tEntry.setName(emitter.getJavaName(typeQName) + dims);
                      }
                      entry.setName(emitter.getJavaName(typeQName) + dims);
                  }
  
                  // If it is not a type, then use this entry's QName to generate its name.
                  else {
                      entry.setName(emitter.getJavaName(entry.getQName()));
                  }
              }
          }
      } // javifyNames
  
      /**
       * Messages, PortTypes, Bindings, and Services can share the same name.  If they do in this
       * Definition, force their names to be suffixed with _PortType and _Service, respectively.
       */
      private void resolveNameClashes(SymbolTable symbolTable) {
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = new Vector((Vector) it.next());  // New vector we can temporarily add to it
              if (v.size() > 1) {
                  boolean resolve = true;
                  // Common Special Case:
                  // If a Type and Element have the same QName, and the Element
                  // uses type= to reference the Type, then they are the same class so 
                  // don't bother mangling.
                  if (v.size() == 2 &&
                      ((v.elementAt(0) instanceof Element &&
                        v.elementAt(1) instanceof Type) ||
                       (v.elementAt(1) instanceof Element &&
                        v.elementAt(0) instanceof Type))) {
                      Element e = null;
                      if (v.elementAt(0) instanceof Element) {
                          e = (Element)v.elementAt(0);
                      } else {
                          e = (Element)v.elementAt(1);
                      }
                      QName eType = Utils.getNodeTypeRefQName(e.getNode(), "type");
                      if (eType != null && eType.equals(e.getQName()))
                          resolve = false;
                  }
  
                  // Other Special Case:
                  // If the names are already different, no mangling is needed.
                  if (resolve) {
                      resolve = false;  // Assume false
                      String name = null;
                      for (int i = 0; i < v.size() && !resolve; ++i) {
                          SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                           if (entry instanceof MessageEntry ||
                               entry instanceof BindingEntry) {
                               ; // Don't process these
                           } else if (name== null) {
                               name = entry.getName();
                           } else if (name.equals(entry.getName())) {
                               resolve = true;  // Need to do resolution
                           } 
  
                      }
                  }
  
                  // Full Mangle if resolution is necessary.
                  if (resolve) {
                      boolean firstType = true;
                      for (int i = 0; i < v.size(); ++i) {
                          SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                          if (entry instanceof Element) {
                              entry.setName(mangleName(entry.getName(),
                                      "_ElemType"));
                              // If this global element was defined using 
                              // an anonymous type, then need to change the
                              // java name of the anonymous type to match.
                              QName anonQName = new QName(entry.getQName().getNamespaceURI(),
                                                          SymbolTable.ANON_TOKEN +
                                                          entry.getQName().getLocalPart());
                              TypeEntry anonType = symbolTable.getType(anonQName);
                              if (anonType != null) {
                                  anonType.setName(entry.getName());
                              }
                          }
                          else if (entry instanceof TypeEntry) {
                              // Search all other types for java names that match this one.
                              // The sameJavaClass method returns true if the java names are
                              // the same (ignores [] ).
                              if (firstType) {
                                  firstType = false;
                                  Vector types = symbolTable.getTypes();
                                  for (int j = 0; j < types.size(); ++j) {
                                      TypeEntry type = (TypeEntry)
                                              types.elementAt(j);
                                      if (type != entry && 
                                              !(type instanceof Element) &&
                                              type.getBaseType() == null &&
                                              sameJavaClass(
                                                      ((Type) entry).getName(),
                                                      type.getName())) {
                                          v.add(type);  
                                      }
                                  }
                              }
                              entry.setName(mangleName(entry.getName(), "_Type"));
                          }
                          else if (entry instanceof PortTypeEntry) {
                              entry.setName(mangleName(entry.getName(), "_Port"));
                          }
                          else if (entry instanceof ServiceEntry) {
                              entry.setName(mangleName(entry.getName(),
                                      "_Service"));
                          }
                          // else if (entry instanceof MessageEntry) {
                          //     we don't care about messages
                          // }
                          else if (entry instanceof BindingEntry) {
                              BindingEntry bEntry = (BindingEntry) entry;
  
                              // If there is no literal use, then we never see a
                              // class named directly from the binding name.  They
                              // all have suffixes:  Stub, Skeleton, Impl.
                              // If there IS literal use, then the SDI will be
                              // named after the binding name, so there is the
                              // possibility of a name clash.
                              if (bEntry.hasLiteral()) {
                                  entry.setName(mangleName(entry.getName(),
                                          "_Binding"));
                              }
                          }
                      }
                  }
              }
          }
      } // resolveNameClashes
  
      /**
       * Change the indicated type name into a mangled form using the mangle string.
       */
      private String mangleName(String name, String mangle) {
          int index = name.indexOf("[");
          if (index >= 0) {
              String pre = name.substring(0, index);
              String post = name.substring(index);
              return pre + mangle + post;
          }
          else
              return name + mangle;
      }
  
      /**
       * Returns true if same java class, ignore []                                 
       */
      private boolean sameJavaClass(String one, String two) {     
          int index1 = one.indexOf("[");
          int index2 = two.indexOf("[");
          if (index1 > 0)
              one = one.substring(0, index1);
          if (index2 > 0)
              two = two.substring(0, index2);
          return one.equals(two);
      }
  
      /**
       * The --all flag is set on the command line (or generateAll(true) is called
       * on WSDL2Java). Set all symbols as referenced (except nonSOAP bindings
       * which we don't know how to deal with).
       */
      private void setAllReferencesToTrue() {
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                  if (entry instanceof BindingEntry &&
                          ((BindingEntry) entry).getBindingType() !=
                          BindingEntry.TYPE_SOAP) {
                      entry.setIsReferenced(false);
                  }
                  else {
                      entry.setIsReferenced(true);
                  }
              }
          }
      } // setAllReferencesToTrue
  
      /**
       * If a binding's type is not TYPE_SOAP, then we don't use that binding
       * or that binding's portType.
       */
      private void ignoreNonSOAPBindings(SymbolTable symbolTable) {
  
          // Look at all uses of the portTypes.  If none of the portType's bindings are of type
          // TYPE_SOAP, then turn off that portType's isReferenced flag.
  
          Vector unusedPortTypes = new Vector();
          Vector usedPortTypes = new Vector();
  
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                  if (entry instanceof BindingEntry) {
                      BindingEntry bEntry = (BindingEntry) entry;
                      Binding binding = bEntry.getBinding();
                      PortType portType = binding.getPortType();
                      PortTypeEntry ptEntry =
                        symbolTable.getPortTypeEntry(portType.getQName());
  
                      if (bEntry.getBindingType() == BindingEntry.TYPE_SOAP) {
                          // If a binding is of type TYPE_SOAP, then mark its portType used
                          // (ie., add it to the usedPortTypes list.  If the portType was
                          // previously marked as unused, unmark it (in other words, remove it
                          // from the unusedPortTypes list).
                          usedPortTypes.add(ptEntry);
                          if (unusedPortTypes.contains(ptEntry)) {
                              unusedPortTypes.remove(ptEntry);
                          }
                      }
                      else {
                          bEntry.setIsReferenced(false);
  
                          // If a binding is not of type TYPE_SOAP, then mark its portType as
                          // unused ONLY if it hasn't already been marked as used.
                          if (!usedPortTypes.contains(ptEntry)) {
                              unusedPortTypes.add(ptEntry);
                          }
                      }
                  }
              }
          }
  
          // Go through all the portTypes that are marked as unused and set their isReferenced flags
          // to false.
          for (int i = 0; i < unusedPortTypes.size(); ++i) {
              PortTypeEntry ptEntry = (PortTypeEntry) unusedPortTypes.get(i);
              ptEntry.setIsReferenced(false);
          }
      } // ignoreNonSOAPBindings
  
      private void constructSignatures(SymbolTable symbolTable) {
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  SymTabEntry entry = (SymTabEntry) v.elementAt(i);
                  if (entry instanceof BindingEntry) {
                      BindingEntry bEntry = (BindingEntry) entry;
                      Binding binding = bEntry.getBinding();
                      PortTypeEntry ptEntry = 
                              symbolTable.getPortTypeEntry(binding.getPortType().getQName());
                      PortType portType = ptEntry.getPortType();
                      Iterator operations = portType.getOperations().iterator();
                      while(operations.hasNext()) {
                          Operation operation = (Operation) operations.next();
                          OperationType type = operation.getStyle();
                          String name = operation.getName();
                          Parameters parameters = bEntry.getParameters(operation);
                          if (type == OperationType.SOLICIT_RESPONSE) {
                              parameters.signature = "    // " + JavaUtils.getMessage(
                                      "invalidSolResp00", name);
                              System.err.println(JavaUtils.getMessage(
                                      "invalidSolResp00", name));
                          }
                          else if (type == OperationType.NOTIFICATION) {
                              parameters.signature = "    // " + JavaUtils.getMessage(
                                      "invalidNotif00", name);
                              System.err.println(JavaUtils.getMessage(
                                      "invalidNotif00", name));
                          }
                          else { // ONE_WAY or REQUEST_RESPONSE
                              parameters.signature = constructSignature( 
                                     parameters, name);
                          }
                      }
                  }
              }
          }
      } // constructSignatures
  
      /**
       * Construct the signature, which is used by both the interface and the stub.
       */
      private String constructSignature(Parameters parms, String opName) {
          String name  = Utils.xmlNameToJava(opName);
          String ret = parms.returnType == null ? "void" : parms.returnType.getName();
          String signature = "    public " + ret + " " + name + "(";
  
          boolean needComma = false;
  
          for (int i = 0; i < parms.list.size(); ++i) {
              Parameter p = (Parameter) parms.list.get(i);
  
              if (needComma) {
                  signature = signature + ", ";
              }
              else {
                  needComma = true;
              }
  
              String javifiedName = Utils.xmlNameToJava(p.getName());
              if (p.getMode() == Parameter.IN) {
                  signature = signature + p.getType().getName() + " " + javifiedName;
              }
              else {
                  signature = signature + Utils.holder(p.getType(), emitter) + " "
                          + javifiedName;
              }
          }
          signature = signature + ") throws java.rmi.RemoteException";
          if (parms.faults != null) {
              // Collect the list of faults into a single string, separated by commas.
              
              Iterator i = parms.faults.values().iterator();
              while (i.hasNext()) {
                  Fault fault = (Fault) i.next();
                  String exceptionName =
                    Utils.getFullExceptionName(fault, emitter);
                  signature = signature + ", " + exceptionName;
              }
          }
          return signature;
      } // constructSignature
  
      /**
       * Find all inout/out parameters and add a flag to the Type of that parameter saying a holder
       * is needed.
       */
      private void determineIfHoldersNeeded(SymbolTable symbolTable) {
          Iterator it = symbolTable.getHashMap().values().iterator();
          while (it.hasNext()) {
              Vector v = (Vector) it.next();
              for (int i = 0; i < v.size(); ++i) {
                  if (v.get(i) instanceof BindingEntry) {
                      // If entry is a BindingEntry, look at all the Parameters
                      // in its portType
                      BindingEntry bEntry = (BindingEntry) v.get(i);
                      PortTypeEntry ptEntry = 
                              symbolTable.getPortTypeEntry(bEntry.getBinding().getPortType().getQName());
                      Iterator operations =
                              bEntry.getParameters().values().iterator();
                      while (operations.hasNext()) {
                          Parameters parms = (Parameters) operations.next();
                          for (int j = 0; j < parms.list.size(); ++j) {
                              Parameter p =
                                      (Parameter)parms.list.get(j);
                              
                              // If the given parameter is an inout or out parameter, then
                              // set a HOLDER_IS_NEEDED flag using the dynamicVar design.
                              if (p.getMode() != Parameter.IN) {
                                  p.getType().setDynamicVar(
                                          JavaTypeWriter.HOLDER_IS_NEEDED,
                                          new Boolean(true));
  
                                  // If the type is a DefinedElement, need to 
                                  // set HOLDER_IS_NEEDED on the anonymous type.
                                  QName anonQName = SchemaUtils.
                                      getElementAnonQName(p.getType().getNode());
                                  if (anonQName != null) {
                                      TypeEntry anonType = 
                                          symbolTable.getType(anonQName);
                                      if (anonType != null) {
                                          anonType.setDynamicVar(
                                              JavaTypeWriter.HOLDER_IS_NEEDED,
                                              new Boolean(true));
                                      }                                    
                                  }
                              }
                          }
                      }
                  }
              }
          }
      } // determineIfHoldersNeeded
  
      /**
       * Get TypeMapping to use for translating
       * QNames to java base types
       */
      BaseTypeMapping btm = null;
      public void setBaseTypeMapping(BaseTypeMapping btm) {
          this.btm = btm;
      }
      public BaseTypeMapping getBaseTypeMapping() {
          if (btm == null) {
              btm = new BaseTypeMapping() {
                      TypeMapping defaultTM = DefaultSOAP12TypeMappingImpl.create();
                      public String getBaseName(QName qNameIn) {
                          javax.xml.rpc.namespace.QName qName = 
                              new javax.xml.rpc.namespace.QName(
                                qNameIn.getNamespaceURI(),                                 
                                qNameIn.getLocalPart());
                          Class cls = defaultTM.getClassForQName(qName);
                          if (cls == null)
                              return null;
                          else 
                              return JavaUtils.getTextClassName(cls.getName());
                      }
                  };    
          }
          return btm;
      }
  
  } // class JavaGeneratorFactory
  
  
  
  1.25      +11 -11    xml-axis/java/test/wsdl/Wsdl2javaAntTask.java
  
  Index: Wsdl2javaAntTask.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaAntTask.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Wsdl2javaAntTask.java	27 Mar 2002 22:58:17 -0000	1.24
  +++ Wsdl2javaAntTask.java	9 May 2002 13:14:29 -0000	1.25
  @@ -55,7 +55,7 @@
   
   import org.apache.axis.utils.XMLUtils;
   
  -import org.apache.axis.wsdl.WSDL2Java;
  +import org.apache.axis.wsdl.toJava.Emitter;
   
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.Project;
  @@ -110,7 +110,7 @@
               log("\ttimeout:" + timeout, Project.MSG_VERBOSE);
   
               // Instantiate the emitter
  -            WSDL2Java emitter = new WSDL2Java();
  +            Emitter emitter = new Emitter();
   
               if ("application".equalsIgnoreCase(deployScope)) {
                   emitter.setScope(emitter.APPLICATION_SCOPE);
  @@ -130,24 +130,24 @@
               if (!namespaceMap.isEmpty()) {
                   emitter.setNamespaceMap(namespaceMap);
               }
  -            emitter.generateTestCase(testCase);
  -            emitter.helperGen(helperGen);    
  +            emitter.setGenerateTestCase(testCase);
  +            emitter.setGenerateHelper(helperGen);    
               if (factory != null) {
  -                emitter.factory(factory);
  +                emitter.setFactory(factory);
               }   
  -            emitter.generateImports(!noImports);
  -            emitter.generateAll(all);
  +            emitter.setImports(!noImports);
  +            emitter.setGenerateAll(all);
               emitter.setOutputDir(output);
  -            emitter.generateServerSide(server);
  -            emitter.deploySkeleton(skeletonDeploy);
  -            emitter.verbose(verbose);
  +            emitter.setGenerateServerSide(server);
  +            emitter.setDeploySkeleton(skeletonDeploy);
  +            emitter.setVerbose(verbose);
               emitter.setTypeMappingVersion(tm);
               emitter.setNStoPkg(project.resolveFile("NStoPkg.properties"));
               emitter.setTimeout(timeout);
   
               log("WSDL2Java " + url, Project.MSG_INFO);
               try {
  -                emitter.emit(url);
  +                emitter.run(url);
               } catch (Throwable e) {
                   if (url.startsWith("http://")) {
                       // What we have is either a network error or invalid XML -