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 2001/10/31 22:46:08 UTC

cvs commit: xml-axis/java/src/org/apache/axis/wsdl JavaServiceInterfaceWriter.java JavaInterfaceWriter.java JavaFaultWriter.java JavaWriter.java JavaPortTypeWriter.java JavaDefinitionWriter.java JavaBindingWriter.java Emitter.java

butek       01/10/31 13:46:08

  Modified:    java/src/org/apache/axis/wsdl JavaWriter.java
                        JavaPortTypeWriter.java JavaDefinitionWriter.java
                        JavaBindingWriter.java Emitter.java
  Added:       java/src/org/apache/axis/wsdl
                        JavaServiceInterfaceWriter.java
                        JavaInterfaceWriter.java JavaFaultWriter.java
  Log:
  Another incremental drop of Writer framework code.  Rearranged stuff for
  JavaInterfaceWriter, JavaServiceInterfaceWriter, JavaFaultWriter.  This is the last
  big change.  There is still some cleanup that has to be done, but it's functional as it is.
  
  Revision  Changes    Path
  1.4       +26 -0     xml-axis/java/src/org/apache/axis/wsdl/JavaWriter.java
  
  Index: JavaWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavaWriter.java	2001/10/31 17:28:55	1.3
  +++ JavaWriter.java	2001/10/31 21:46:07	1.4
  @@ -69,6 +69,22 @@
   * All of Wsdl2java's Writer implementations do some common stuff.  All this
   * common stuff resides in this abstract base class.  All that extensions to
   * this class have to do is implement writeFileBody.
  +*
  +* Emitter knows about WSDL writers, one each for PortType, Binding, Service,
  +* Definition, Type.  But for some of these WSDL types, Wsdl2java generates
  +* multiple files.  Each of these files has a corresponding writer that extends
  +* JavaWriter.  So the Java WSDL writers (JavaPortTypeWriter, JavaBindingWriter,
  +* etc.) each calls a file writer (JavaStubWriter, JavaSkelWriter, etc.) for
  +* each file that that WSDL generates.
  +*
  +* For example, when Emitter calls JavaWriterFactory for a Binding Writer, it
  +* returns a JavaBindingWriter.  JavaBindingWriter, in turn, contains a
  +* JavaStubWriter, JavaSkelWriter, and JavaImplWriter since a Binding may cause
  +* a stub, skeleton, and impl template to be generated.
  +*
  +* Note that the writers that are given to Emitter by JavaWriterFactory DO NOT
  +* extend JavaWriter.  They simply implement Writer and delegate the actual
  +* task of writing to extensions of JavaWriter.
   */
   
   public abstract class JavaWriter implements Writer {
  @@ -244,6 +260,16 @@
           pw.println();
           pw.println("<m:" + deploymentOpName + " xmlns:m=\"AdminService\">");
       } // initializeDeploymentDoc
  +
  +    /**
  +     * Does the given file already exist?
  +     */
  +    protected boolean fileExists (String name, String namespace) throws IOException
  +    {
  +        String packageName = emitter.getNamespaces().getAsDir(namespace);
  +        String fullName = packageName + name;
  +        return new File (fullName).exists();
  +    } // fileExists
   
       /**
        * Write the body of the file.  This is what extenders of this class must
  
  
  
  1.2       +17 -36    xml-axis/java/src/org/apache/axis/wsdl/JavaPortTypeWriter.java
  
  Index: JavaPortTypeWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaPortTypeWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaPortTypeWriter.java	2001/10/30 13:20:14	1.1
  +++ JavaPortTypeWriter.java	2001/10/31 21:46:07	1.2
  @@ -57,20 +57,18 @@
   import java.io.IOException;
   
   import java.util.HashMap;
  -import java.util.HashSet;
  -import java.util.Iterator;
   
  -import javax.wsdl.Operation;
   import javax.wsdl.PortType;
   import javax.wsdl.QName;
   
   /**
   * This is Wsdl2java's PortType Writer.  It writes the <portTypeName>.java file
  -* which contains the <portTypeName> interface.
  +* which contains the <portTypeName> interface and, when appropriate, the
  +* <portTypeName>AXIS.java file which contains the server-side interface.
   */
  -public class JavaPortTypeWriter extends JavaWriter {
  -    private PortType portType;
  -    private HashMap  operationParameters;
  +public class JavaPortTypeWriter implements Writer {
  +    private Writer interfaceWriter = null;
  +    private Writer serviceInterfaceWriter = null;
   
       /**
        * Constructor.
  @@ -78,38 +76,21 @@
       protected JavaPortTypeWriter(
               Emitter emitter,
               PortType portType, HashMap operationParameters) {
  -        super(emitter, new QName(portType.getQName().getNamespaceURI(), Utils.capitalize(Utils.xmlNameToJava(portType.getQName().getLocalPart()))), "", "java", "Generating portType interface:  ");
  -        this.portType = portType;
  -        this.operationParameters = operationParameters;
  +        QName qname = new QName(portType.getQName().getNamespaceURI(), Utils.capitalize(Utils.xmlNameToJava(portType.getQName().getLocalPart())));
  +        portType.setQName(qname);
  +        interfaceWriter = new JavaInterfaceWriter(emitter, portType, operationParameters);
  +        if (emitter.bEmitSkeleton && emitter.bMessageContext) {
  +            serviceInterfaceWriter = new JavaServiceInterfaceWriter(emitter, portType, operationParameters);
  +        }
       } // ctor
   
       /**
  -     * Write the body of the portType interface file.
  +     * Write all the portType bindings:  <portTypeName>.java, <portTypeName>AXIS.java.
        */
  -    protected void writeFileBody() throws IOException {
  -        pw.println("public interface " + className + " extends java.rmi.Remote {");
  -
  -        // Remove Duplicates - happens with only a few WSDL's. No idea why!!! 
  -        // (like http://www.xmethods.net/tmodels/InteropTest.wsdl) 
  -        // TODO: Remove this patch...
  -        // NOTE from RJB:  this is a WSDL4J bug and the WSDL4J guys have been notified.
  -        Iterator operations = (new HashSet(portType.getOperations())).iterator();
  -        while(operations.hasNext()) {
  -            Operation operation = (Operation) operations.next();
  -            writeOperation(portType, operation, qname.getNamespaceURI());
  +    public void write() throws IOException {
  +        interfaceWriter.write();
  +        if (serviceInterfaceWriter != null) {
  +            serviceInterfaceWriter.write();
           }
  -
  -        pw.println("}");
  -        pw.close();
  -    } // writeFileBody
  -
  -    /**
  -     * This method generates the interface signatures for the given operation.
  -     */
  -    private void writeOperation(PortType portType, Operation operation, String namespace) throws IOException {
  -        writeComment(pw, operation.getDocumentationElement());
  -        Emitter.Parameters parms = (Emitter.Parameters) operationParameters.get(operation);
  -        pw.println(parms.signature + ";");
  -    } // writeOperation
  -
  +    } // write
   } // class JavaPortTypeWriter
  
  
  
  1.2       +43 -0     xml-axis/java/src/org/apache/axis/wsdl/JavaDefinitionWriter.java
  
  Index: JavaDefinitionWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaDefinitionWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaDefinitionWriter.java	2001/10/31 17:28:55	1.1
  +++ JavaDefinitionWriter.java	2001/10/31 21:46:07	1.2
  @@ -56,7 +56,16 @@
   
   import java.io.IOException;
   
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Map;
  +
   import javax.wsdl.Definition;
  +import javax.wsdl.Fault;
  +import javax.wsdl.Operation;
  +import javax.wsdl.PortType;
  +import javax.wsdl.QName;
   
   /**
   * This is Wsdl2java's Definition Writer.  It writes the following files:
  @@ -65,6 +74,8 @@
   public class JavaDefinitionWriter implements Writer {
       Writer deployWriter = null;
       Writer undeployWriter = null;
  +    Emitter emitter;
  +    Definition definition;
   
       /**
        * Constructor.
  @@ -72,6 +83,8 @@
       protected JavaDefinitionWriter(Emitter emitter, Definition definition) {
           deployWriter = new JavaDeployWriter(emitter, definition);
           undeployWriter = new JavaUndeployWriter(emitter, definition);
  +        this.emitter = emitter;
  +        this.definition = definition;
       } // ctor
   
       /**
  @@ -80,6 +93,36 @@
       public void write() throws IOException {
           deployWriter.write();
           undeployWriter.write();
  +        writeFaults();
       } // write
  +
  +    /**
  +     * Write all the faults.
  +     * NOTE:  this must be rewritten.  It doesn't follow JAX-RPC.
  +     */
  +    private void writeFaults() throws IOException {
  +        HashSet faults = new HashSet();
  +        Map portTypes = definition.getPortTypes();
  +        Iterator pti = portTypes.values().iterator();
  +        while (pti.hasNext()) {
  +            PortType portType = (PortType) pti.next();
  +            List operations = portType.getOperations();
  +            for (int i = 0; i < operations.size(); ++i) {
  +                Operation operation = (Operation) operations.get(i);
  +                Map opFaults = operation.getFaults();
  +                Iterator fi = opFaults.values().iterator();
  +                while (fi.hasNext()) {
  +                    faults.add(fi.next());
  +                }
  +            }
  +        }
  +        Iterator fi = faults.iterator();
  +        while (fi.hasNext()) {
  +            Fault fault = (Fault) fi.next();
  +            String exceptionName = Utils.capitalize(Utils.xmlNameToJava(fault.getName()));
  +            QName faultName = new QName(definition.getTargetNamespace(), exceptionName);
  +            new JavaFaultWriter(emitter, faultName, fault).write();
  +        }
  +    } // writeFaults
   
   } // class JavaDefinitionWriter
  
  
  
  1.3       +2 -1      xml-axis/java/src/org/apache/axis/wsdl/JavaBindingWriter.java
  
  Index: JavaBindingWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/JavaBindingWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaBindingWriter.java	2001/10/30 22:24:56	1.2
  +++ JavaBindingWriter.java	2001/10/31 21:46:07	1.3
  @@ -84,7 +84,8 @@
               skelWriter = new JavaSkelWriter(emitter, binding, operationParameters);
               String fileName = bindingQName.getLocalPart() + "Impl.java";
               try {
  -                if (!emitter.fileExists (fileName, bindingQName.getNamespaceURI())) {
  +                // NOTE:  Where does the fileExists method really belong?
  +                if (!((JavaWriter) stubWriter).fileExists (fileName, bindingQName.getNamespaceURI())) {
                       implWriter = new JavaImplWriter(emitter, binding, operationParameters);
                   }
               }
  
  
  
  1.95      +8 -142    xml-axis/java/src/org/apache/axis/wsdl/Emitter.java
  
  Index: Emitter.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Emitter.java,v
  retrieving revision 1.94
  retrieving revision 1.95
  diff -u -r1.94 -r1.95
  --- Emitter.java	2001/10/31 17:28:55	1.94
  +++ Emitter.java	2001/10/31 21:46:07	1.95
  @@ -72,10 +72,7 @@
   import javax.wsdl.PortType;
   import javax.wsdl.QName;
   import javax.wsdl.Service;
  -import java.io.File;
  -import java.io.FileWriter;
   import java.io.IOException;
  -import java.io.PrintWriter;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.HashMap;
  @@ -402,46 +399,13 @@
   
           while (i.hasNext()) {
               PortType portType = (PortType) i.next();
  -
  -            writePortType(portType);
  -            if (bEmitSkeleton && bMessageContext) {
  -                writeAxisPortType(portType);
  -            }
  +            HashMap operationParameters = (HashMap) portTypesInfo.get(portType);
  +            Writer writer = writerFactory.getWriter(portType, operationParameters);
  +            writer.write();
           }
       } // writePortTypes
   
       /**
  -     * Generate the interface for the given port type.
  -     */
  -    private void writePortType(PortType portType) throws IOException {
  -        HashMap operationParameters = (HashMap) portTypesInfo.get(portType);
  -        Writer writer = writerFactory.getWriter(portType, operationParameters);
  -        writer.write();
  -    } // writePortType
  -
  -    /**
  -     * Generate the server-side (Axis) interface for the given port type.
  -     */
  -    private void writeAxisPortType(PortType portType) throws IOException {
  -        QName portTypeQName = portType.getQName();
  -        PrintWriter interfacePW = printWriter(portTypeQName, "Axis", "java", "Generating server-side PortType interface:  ");
  -        String nameValue = Utils.xmlNameToJava(portTypeQName.getLocalPart()) + "Axis";
  -
  -        writeFileHeader(nameValue + ".java", namespaces.getCreate(portTypeQName.getNamespaceURI()), interfacePW);
  -        interfacePW.println("public interface " + nameValue + " extends java.rmi.Remote {");
  -
  -        List operations = portType.getOperations();
  -
  -        for (int i = 0; i < operations.size(); ++i) {
  -            Operation operation = (Operation) operations.get(i);
  -            writeOperationAxisSkelSignatures(portType, operation, portType.getQName().getNamespaceURI(), interfacePW);
  -        }
  -
  -        interfacePW.println("}");
  -        interfacePW.close();
  -    } // writeAxisPortType
  -
  -    /**
        * This class simply collects
        */
       protected static class Parameter {
  @@ -604,10 +568,12 @@
           Map faults = operation.getFaults();
           Iterator i = faults.values().iterator();
           while (i.hasNext()) {
  +            Fault fault = (Fault) i.next();
  +            String exceptionName = Utils.capitalize(Utils.xmlNameToJava((String) fault.getName()));
               if (parameters.faultString == null)
  -                parameters.faultString = fault((Fault) i.next(), namespace);
  +                parameters.faultString = exceptionName;
               else
  -                parameters.faultString = parameters.faultString + ", " + fault((Fault) i.next(), namespace);
  +                parameters.faultString = parameters.faultString + ", " + exceptionName;
           }
   
           if (parameters.returnType == null)
  @@ -744,7 +710,7 @@
        * This method returns a vector containing the Java types (even indices) and
        * names (odd indices) of the parts.
        */
  -    private void partStrings(Vector v, Collection parts, boolean literal) {
  +    protected void partStrings(Vector v, Collection parts, boolean literal) {
           Iterator i = parts.iterator();
   
           while (i.hasNext()) {
  @@ -772,56 +738,6 @@
       } // partStrings
   
       /**
  -     * This method generates the axis server side impl interface signatures operation.
  -     */
  -    private void writeOperationAxisSkelSignatures(PortType portType, Operation operation, String namespace, PrintWriter interfacePW) throws IOException {
  -        Parameters parms = (Parameters) ((HashMap) portTypesInfo.get(portType)).get(operation);
  -        interfacePW.println(parms.axisSignature + ";");
  -    } // writeOperationAxisSkelSignatures
  -
  -    /**
  -     * This generates an exception class for the given fault and returns the capitalized name of
  -     * the fault.
  -     */
  -    private String fault(Fault operation, String namespace) throws IOException {
  -        String exceptionName = Utils.capitalize(Utils.xmlNameToJava(operation.getName()));
  -        QName qname = new QName(namespace, exceptionName);
  -        PrintWriter pw = printWriter(qname, null, "java", "Generating Fault class:  ");
  -
  -        writeFileHeader(exceptionName + ".java", namespaces.getCreate(namespace), pw);
  -        pw.println("public class " + exceptionName + " extends Exception {");
  -
  -        Vector params = new Vector();
  -
  -        partStrings(params, operation.getMessage().getOrderedParts(null), false);
  -
  -        for (int i = 0; i < params.size(); i += 2)
  -            pw.println("    public " + params.get(i) + " " + params.get(i + 1) + ";");
  -
  -        pw.println();
  -        pw.println("    public " + exceptionName + "() {");
  -        pw.println("    }");
  -        pw.println();
  -        if (params.size() > 0) {
  -            pw.print("      public " + exceptionName + "(");
  -            for (int i = 0; i < params.size(); i += 2) {
  -                if (i != 0) pw.print(", ");
  -                pw.print(params.get(i) + " " + params.get(i + 1));
  -            }
  -            pw.println(") {");
  -            for (int i = 1; i < params.size(); i += 2) {
  -                String variable = (String) params.get(i);
  -
  -                pw.println("        this." + variable + " = " + variable + ";");
  -            }
  -            pw.println("    }");
  -        }
  -        pw.println("}");
  -        pw.close();
  -        return exceptionName;
  -    } // fault
  -
  -    /**
        * Generate the stubs and skeletons for all binding tags.
        */
       private void writeBindings() throws IOException {
  @@ -896,54 +812,4 @@
       public TypeFactory getTypeFactory() {
           return emitFactory;
       } // getTypeFactory
  -
  -    /**
  -     * Does the given file already exist?
  -     */
  -    protected boolean fileExists (String name, String namespace) throws IOException
  -    {
  -        String packageName = namespaces.getAsDir(namespace);
  -        String fullName = packageName + name;
  -        return new File (fullName).exists();
  -    } // fileExists
  -
  -    /**
  -     * Get a PrintWriter attached to a file with the given name.
  -     */
  -    private PrintWriter printWriter(QName qname, String suffix, String extension, String message) throws IOException
  -    {
  -        String name = qname.getLocalPart();
  -        // Don't capitalize for deploy.xml and undeploy.xml
  -        if(name.indexOf("deploy")==-1)
  -            name = Utils.capitalize(Utils.xmlNameToJava(name));
  -        String fileName = name + (suffix == null ? "" : suffix) + '.' + extension;
  -        String packageName = namespaces.getCreate(qname.getNamespaceURI());
  -        String packageDirName = namespaces.toDir(packageName);
  -        fileList.add(packageDirName + fileName);
  -        classList.add(packageName + "." + name);
  -        File file = new File(packageDirName, fileName);
  -        if (bVerbose) {
  -            System.out.println(message + file.getPath());
  -        }
  -        return new PrintWriter(new FileWriter(file));
  -    } // printWriter
  -
  -
  -    /**
  -     * Write a common header, including the package name to the
  -     * provided stream
  -     */
  -    protected void writeFileHeader(String filename, String pkgName, PrintWriter pw) {
  -        pw.println("/**");
  -        pw.println(" * " + filename);
  -        pw.println(" *");
  -        pw.println(" * This file was auto-generated from WSDL");
  -        pw.println(" * by the Apache Axis Wsdl2java emitter.");
  -        pw.println(" */");
  -        pw.println();
  -
  -        // print package declaration
  -        pw.println("package " + pkgName + ";");
  -        pw.println();
  -    }
   }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/JavaServiceInterfaceWriter.java
  
  Index: JavaServiceInterfaceWriter.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;
  
  import java.io.IOException;
  
  import java.util.HashMap;
  import java.util.List;
  
  import javax.wsdl.Operation;
  import javax.wsdl.PortType;
  
  /**
  * This is Wsdl2java's service writer.  It writes the <serviceName>.java file.
  */
  public class JavaServiceInterfaceWriter extends JavaWriter {
      private PortType portType;
      private HashMap operationParameters;
  
      /**
       * Constructor.
       */
      protected JavaServiceInterfaceWriter(
              Emitter emitter,
              PortType portType,
              HashMap operationParameters) {
          super(emitter, portType.getQName(), "AXIS", "java", "Generating server-side PortType interface:  ");
          this.portType = portType;
          this.operationParameters = operationParameters;
      } // ctor
  
      /**
       * Generate the server-side (Axis) interface for the given port type.
       */
      protected void writeFileBody() throws IOException {
          pw.println("public interface " + className + " extends java.rmi.Remote {");
  
          List operations = portType.getOperations();
  
          for (int i = 0; i < operations.size(); ++i) {
              Operation operation = (Operation) operations.get(i);
              writeOperationAxisSkelSignatures(operation);
          }
  
          pw.println("}");
          pw.close();
      } // writeFileBody
  
      /**
       * This method generates the axis server side impl interface signatures operation.
       */
      private void writeOperationAxisSkelSignatures(Operation operation) throws IOException {
          Emitter.Parameters parms = (Emitter.Parameters) operationParameters.get(operation);
          pw.println(parms.axisSignature + ";");
      } // writeOperationAxisSkelSignatures
  
  } // class JavaServiceInterfaceWriter
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/JavaInterfaceWriter.java
  
  Index: JavaInterfaceWriter.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;
  
  import java.io.IOException;
  
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Iterator;
  
  import javax.wsdl.Operation;
  import javax.wsdl.PortType;
  
  /**
  * This is Wsdl2java's PortType Writer.  It writes the <portTypeName>.java file
  * which contains the <portTypeName> interface.
  */
  public class JavaInterfaceWriter extends JavaWriter {
      private PortType portType;
      private HashMap  operationParameters;
  
      /**
       * Constructor.
       */
      protected JavaInterfaceWriter(
              Emitter emitter,
              PortType portType, HashMap operationParameters) {
          super(emitter, portType.getQName(), "", "java", "Generating portType interface:  ");
          this.portType = portType;
          this.operationParameters = operationParameters;
      } // ctor
  
      /**
       * Write the body of the portType interface file.
       */
      protected void writeFileBody() throws IOException {
          pw.println("public interface " + className + " extends java.rmi.Remote {");
  
          // Remove Duplicates - happens with only a few WSDL's. No idea why!!! 
          // (like http://www.xmethods.net/tmodels/InteropTest.wsdl) 
          // TODO: Remove this patch...
          // NOTE from RJB:  this is a WSDL4J bug and the WSDL4J guys have been notified.
          Iterator operations = (new HashSet(portType.getOperations())).iterator();
          while(operations.hasNext()) {
              Operation operation = (Operation) operations.next();
              writeOperation(portType, operation, qname.getNamespaceURI());
          }
  
          pw.println("}");
          pw.close();
      } // writeFileBody
  
      /**
       * This method generates the interface signatures for the given operation.
       */
      private void writeOperation(PortType portType, Operation operation, String namespace) throws IOException {
          writeComment(pw, operation.getDocumentationElement());
          Emitter.Parameters parms = (Emitter.Parameters) operationParameters.get(operation);
          pw.println(parms.signature + ";");
      } // writeOperation
  
  } // class JavaInterfaceWriter
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/JavaFaultWriter.java
  
  Index: JavaFaultWriter.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;
  
  import java.io.IOException;
  
  import java.util.Vector;
  
  import javax.wsdl.Fault;
  import javax.wsdl.QName;
  
  /**
  * This is Wsdl2java's Fault Writer.  It writes the <faultName>.java file.
  * NOTE:  this must be rewritten.  It doesn't follow JAX-RPC.
  */
  public class JavaFaultWriter extends JavaWriter {
      private Fault fault;
  
      /**
       * Constructor.
       */
      protected JavaFaultWriter(Emitter emitter, QName qname, Fault fault) {
          super(emitter, qname, "", "java", "Generating Fault class:  ");
          this.fault = fault;
      } // ctor
  
      /**
       * Write the body of the Fault file.
       */
      protected void writeFileBody() throws IOException {
          pw.println("public class " + className + " extends Exception {");
  
          Vector params = new Vector();
  
          emitter.partStrings(params, fault.getMessage().getOrderedParts(null), false);
  
          for (int i = 0; i < params.size(); i += 2)
              pw.println("    public " + params.get(i) + " " + params.get(i + 1) + ";");
  
          pw.println();
          pw.println("    public " + className + "() {");
          pw.println("    }");
          pw.println();
          if (params.size() > 0) {
              pw.print("      public " + className + "(");
              for (int i = 0; i < params.size(); i += 2) {
                  if (i != 0) pw.print(", ");
                  pw.print(params.get(i) + " " + params.get(i + 1));
              }
              pw.println(") {");
              for (int i = 1; i < params.size(); i += 2) {
                  String variable = (String) params.get(i);
  
                  pw.println("        this." + variable + " = " + variable + ";");
              }
              pw.println("    }");
          }
          pw.println("}");
          pw.close();
      } // writeFileBody
  
  } // class JavaFaultWriter