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/10/09 22:51:31 UTC

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

butek       2002/10/09 13:51:31

  Modified:    java/src/org/apache/axis/wsdl/symbolTable SymbolTable.java
                        Utils.java
               java/src/org/apache/axis/wsdl/toJava
                        JavaDefinitionWriter.java JavaDeployWriter.java
                        JavaFaultWriter.java JavaGeneratorFactory.java
                        JavaStubWriter.java JavaTestCaseWriter.java
                        Utils.java
               java/test/wsdl/header header.wsdl
  Added:       java/src/org/apache/axis/wsdl/symbolTable FaultInfo.java
  Log:
  The recent fault fixes looked, I'm sorry to say, like one big hack.  This isn't
  particularly surprising considering the mad rush to get faults working
  before the soap builders' interop meeting.  But it caused me a couple
  ulcers.
  
  - FaultInfo was an inner class inside JavaDefinitionWriter AND it was used
  by SymbolTable.  This was just plain wrong!  There should be absolutely
  NO dependencies by the parser/symbol table front end on the emitter back
  end.  So I pulled FaultInfo into its own class and put it into the symbolTable
  package.
  
  - FaultInfo was nothing but a struct and you had to use Util methods to
  massage that info.  Tsk tsk.  Not very OO.  I've moved the logic from
  various Utils methods into the FaultInfo class itself.
  - The fault changes broke soap:headerfault.  Faults that were declared in
  the portType weren't being generated if they appeared in a
  soap:headerfault.  They only worked if they appeared in the binding as a
  soap:fault.  I've fixed this and uncommented the soap:headerfault bits of
  the header test.
  
  A couple remaining problems.
  - I still have a serious concern about the fault logic based on the binding
  rather than the portType, but that's a bigger fish than I wanted to fry right
  now (I'm in the mood for trout and this thing's a whopping flounder).  One
  particular issue:  if a WSDL file contains a portType but DOES NOT contain
  a binding, fault exceptions would not be generated, therefore, even though
  the SEI should be generated, it won't compile.  (There's a more serious
  problem in that this sort of WSDL won't even generate the SEI now.  This
  broke somewhere along the way.)
  - Now that FaultInfo is a real object, it seems like it should really be a
  subclass of SymTabEntry, ie., FaultEntry.  But faults aren't first-class
  objects in WSDL, so creating a FaultEntry could be problemmatic.  Needs
  more thought.
  
  Revision  Changes    Path
  1.46      +79 -65    xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- SymbolTable.java	9 Oct 2002 19:06:32 -0000	1.45
  +++ SymbolTable.java	9 Oct 2002 20:51:28 -0000	1.46
  @@ -103,12 +103,12 @@
   import javax.wsdl.extensions.soap.SOAPBody;
   import javax.wsdl.extensions.soap.SOAPFault;
   import javax.wsdl.extensions.soap.SOAPHeader;
  +import javax.wsdl.extensions.soap.SOAPHeaderFault;
   
   import javax.xml.rpc.holders.BooleanHolder;
   import javax.xml.rpc.holders.IntHolder;
   
   import org.apache.axis.Constants;
  -import org.apache.axis.wsdl.toJava.JavaDefinitionWriter;
   
   import org.apache.axis.enum.Style;
   import org.apache.axis.enum.Use;
  @@ -1546,82 +1546,30 @@
                               new String[] {opName, inputName, outputName}));
                   }
   
  +                ArrayList faults = new ArrayList();
  +
                   // input
                   if (bindingInput != null) {
                       if (bindingInput.getExtensibilityElements() != null) {
  -                        Iterator inIter = bindingInput.getExtensibilityElements().iterator();
  -                        fillInBindingInfo(bEntry, operation, inIter, true);
  +                        Iterator inIter = bindingInput.
  +                                getExtensibilityElements().iterator();
  +                        fillInBindingInfo(bEntry, operation, inIter, faults,
  +                                true);
                       }
                   }
   
                   // output
                   if (bindingOutput != null) {
                       if (bindingOutput.getExtensibilityElements() != null) {
  -                        Iterator outIter = bindingOutput.getExtensibilityElements().iterator();
  -                        fillInBindingInfo(bEntry, operation, outIter, false);
  +                        Iterator outIter = bindingOutput.
  +                                getExtensibilityElements().iterator();
  +                        fillInBindingInfo(bEntry, operation, outIter, faults,
  +                                false);
                       }
                   }
   
                   // faults
  -                ArrayList faults = new ArrayList();
  -                Iterator faultMapIter = bindOp.getBindingFaults().values().iterator();
  -                for (; faultMapIter.hasNext(); ) {
  -                    BindingFault bFault = (BindingFault)faultMapIter.next();
  -
  -                    // Set default entry for this fault
  -                    String faultName = bFault.getName();
  -
  -                    // Check to make sure this fault is named
  -                    if (faultName == null || faultName.length() == 0) {
  -                        throw new IOException(
  -                                Messages.getMessage("unNamedFault00", 
  -                                                    bindOp.getName(), 
  -                                                    binding.getQName().toString()));
  -                    }
  -                    
  -                    SOAPFault soapFault = null;
  -                    Iterator faultIter =
  -                            bFault.getExtensibilityElements().iterator();
  -                    for (; faultIter.hasNext();) {
  -                        Object obj = faultIter.next();
  -                        if (obj instanceof SOAPFault) {
  -                            soapFault = (SOAPFault) obj;
  -                            break;
  -                        }
  -                    }
  -                    
  -                    // Check to make sure we have a soap:fault element
  -                    if (soapFault == null) {
  -                        throw new IOException(
  -                                Messages.getMessage("missingSoapFault00",
  -                                                    faultName,
  -                                                    bindOp.getName(), 
  -                                                    binding.getQName().toString()));
  -                    }
  -                    
  -                    // TODO error checking:
  -                    // if use=literal, no use of namespace on the soap:fault
  -                    // if use=encoded, no use of element on the part
  -
  -                    // Check this fault to make sure it matches the one
  -                    // in the matching portType Operation
  -                    Fault opFault = operation.getFault(bFault.getName());
  -                    if (opFault == null) {
  -                        throw new IOException(
  -                                Messages.getMessage("noPortTypeFault",
  -                                  new String[] {bFault.getName(), 
  -                                          bindOp.getName(), 
  -                                          binding.getQName().toString()}));
  -                    }
  -                    
  -                    QName xmlType = Utils.getFaultType(opFault, this);
  -                    
  -                    // put the updated entry back in the map
  -                    faults.add(new JavaDefinitionWriter.FaultInfo(opFault, 
  -                                                                  soapFault,
  -                                                                  xmlType));
  -                }
  -                bEntry.setFaultBodyTypeMap(operation, faultMap);
  +                faultsFromSOAPFault(binding, bindOp, operation, faults);
   
                   // Add this fault name and info to the map
                   faultMap.put(bindOp, faults);
  @@ -1652,7 +1600,7 @@
        * Fill in some binding information:  bodyType, mimeType, header info.
        */
       private void fillInBindingInfo(BindingEntry bEntry, Operation operation,
  -            Iterator it, boolean input) throws IOException {
  +            Iterator it, ArrayList faults, boolean input) throws IOException {
           for (; it.hasNext();) {
               Object obj = it.next();
               if (obj instanceof SOAPBody) {
  @@ -1671,6 +1619,14 @@
                   // know what we're supposed to emit for implicit headers.
                   bEntry.setHeaderPart(operation.getName(), header.getPart(),
                           input ? BindingEntry.IN_HEADER : BindingEntry.OUT_HEADER);
  +
  +                // Add any soap:headerFault info to the faults array
  +                Iterator headerFaults = header.getSOAPHeaderFaults().iterator();
  +                while (headerFaults.hasNext()) {
  +                    SOAPHeaderFault headerFault =
  +                            (SOAPHeaderFault) headerFaults.next();
  +                    faults.add(new FaultInfo(headerFault, this));
  +                }
               }
               else if (obj instanceof MIMEMultipartRelated) {
                   bEntry.setBodyType(operation,
  @@ -1679,6 +1635,64 @@
               }
           }
       } // fillInBindingInfo
  +
  +    /**
  +     * Get the faults from the soap:fault clause.
  +     */
  +    private void faultsFromSOAPFault(Binding binding, BindingOperation bindOp,
  +            Operation operation, ArrayList faults) throws IOException {
  +        Iterator faultMapIter = bindOp.getBindingFaults().values().iterator();
  +        for (; faultMapIter.hasNext(); ) {
  +            BindingFault bFault = (BindingFault)faultMapIter.next();
  +
  +            // Set default entry for this fault
  +            String faultName = bFault.getName();
  +
  +            // Check to make sure this fault is named
  +            if (faultName == null || faultName.length() == 0) {
  +                throw new IOException(Messages.getMessage("unNamedFault00", 
  +                        bindOp.getName(), 
  +                        binding.getQName().toString()));
  +            }
  +
  +            SOAPFault soapFault = null;
  +            Iterator faultIter = bFault.getExtensibilityElements().iterator();
  +            for (; faultIter.hasNext();) {
  +                Object obj = faultIter.next();
  +                if (obj instanceof SOAPFault) {
  +                    soapFault = (SOAPFault) obj;
  +                    break;
  +                }
  +            }
  +
  +            // Check to make sure we have a soap:fault element
  +            if (soapFault == null) {
  +                throw new IOException(Messages.getMessage("missingSoapFault00",
  +                        faultName,
  +                        bindOp.getName(), 
  +                        binding.getQName().toString()));
  +            }
  +
  +            // TODO error checking:
  +            // if use=literal, no use of namespace on the soap:fault
  +            // if use=encoded, no use of element on the part
  +
  +            // Check this fault to make sure it matches the one
  +            // in the matching portType Operation
  +            Fault opFault = operation.getFault(bFault.getName());
  +            if (opFault == null) {
  +                throw new IOException(Messages.getMessage("noPortTypeFault",
  +                        new String[] {bFault.getName(), 
  +                        bindOp.getName(), 
  +                        binding.getQName().toString()}));
  +            }
  +            // put the updated entry back in the map
  +            faults.add(new FaultInfo(opFault,
  +                    Use.getUse(soapFault.getUse()),
  +                    soapFault.getNamespaceURI(),
  +                    this));
  +        }
  +    } // faultsFromSOAPFault
   
       /**
        * Set the body type.
  
  
  
  1.20      +0 -61     xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java
  
  Index: Utils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/symbolTable/Utils.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Utils.java	8 Oct 2002 03:31:33 -0000	1.19
  +++ Utils.java	9 Oct 2002 20:51:28 -0000	1.20
  @@ -610,66 +610,5 @@
                   "=\"" + qname.getNamespaceURI();
       }
       
  -    /**
  -     * Get the XML type (QName) for a Fault - look in the (single) fault
  -     * part for type="" or element="" - if type, return the QName.  If
  -     * element, return the reference type for the element.
  -     * 
  -     * @param fault the Fault to dig into
  -     * @param st the SymbolTable we're using
  -     * @return the XML type of the Fault's part, or null
  -     */ 
  -    public static QName getFaultType(Fault fault, SymbolTable st) {
  -        Part part = getFaultPart(fault);
  -        if (part != null) {
  -            if (part.getTypeName() != null) {
  -                return part.getTypeName();
  -            }
  -            // Literal, so get the element's type
  -            TypeEntry entry = st.getElement(part.getElementName());
  -            if (entry != null) {
  -                return entry.getRefType().getQName();
  -            }
  -        }
  -        return null;
  -    }
  -
  -    /**
  -     * Return the QName of a fault
  -     * 
  -     * Can return null if no parts in fault
  -     */ 
  -    public static QName getFaultQName(Fault fault, SOAPFault soapFault) {
  -        Part part = getFaultPart(fault);
  -        
  -        if (part == null) return null;
  -        
  -        // Someone should have already made sure that
  -        // if use=literal, no use of namespace on the soap:fault
  -        // if use=encoded, no use of element on the part
  -        if (part.getTypeName() != null) {
  -            String namespace = soapFault.getNamespaceURI();
  -            // Now make a QName
  -            return new QName(namespace, part.getName());
  -        } else {
  -            // Use the element's QName for the fault
  -            return part.getElementName();
  -        }
  -    }
  -
  -    private static Part getFaultPart(Fault fault) {
  -        // get the name of the part - there can be only one!
  -        Message message = fault.getMessage();
  -        Map parts = message.getParts();
  -        // If no parts, skip it
  -        if (parts.size() == 0) {
  -            return null;
  -        }
  -                
  -        // We have 2 cases
  -        // - part is an element, use element name and namespace
  -        // - part is a type, use part name and binding namespace 
  -        return (Part) parts.values().iterator().next();
  -    }
   }
   
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/wsdl/symbolTable/FaultInfo.java
  
  Index: FaultInfo.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 javax.wsdl.extensions.soap.SOAPHeaderFault;
  
  import javax.wsdl.Fault;
  import javax.wsdl.Message;
  import javax.wsdl.Part;
  
  import javax.xml.namespace.QName;
  
  import org.apache.axis.enum.Use;
  
  /**
  * Fault information object.  This should probably really be FaultEntry and
  * it should be a subclass of SymTabEntry, but faults aren't first-class
  * objects in WSDL, so I'm not sure what the FaultEntry should contain and
  * how it should be constructed, so for now leave it as a simple object.
  */
  
  public class FaultInfo {
      private Message message;
      private QName   xmlType;
      private Use     use;
      private QName   qName;
  
      /**
       * This constructor creates FaultInfo for a binding fault.
       *
       * If the part of the fault is a type, then the QName is
       * derived from the element name and the provided namespace
       * (this namespace SHOULD come from the binding).
       *
       * If the part of the fault is an element, then the QName is
       * the QName of the element, and the given namespace is ignored.
       */
      public FaultInfo(Fault fault, Use use, String namespace,
              SymbolTable symbolTable) {
          this.message = fault.getMessage();
          this.xmlType = getFaultType(symbolTable, getFaultPart());
          this.use     = use;
  
          Part part = getFaultPart();
          if (part == null) {
              this.qName = null;
          }
          else if (part.getTypeName() != null) {
              this.qName = new QName(namespace, part.getName());
          }
          else {
              this.qName = part.getElementName();
          }
      } // ctor
  
      /**
       * This constructor creates FaultInfo for a soap:headerFault.
       */
      public FaultInfo(SOAPHeaderFault fault, SymbolTable symbolTable) {
          this.message = symbolTable.getMessageEntry(fault.getMessage()).
                  getMessage();
          Part part    = message.getPart(fault.getPart());
          this.xmlType = getFaultType(symbolTable, part);
          this.use     = Use.getUse(fault.getUse());
  
          if (part == null) {
              this.qName = null;
          }
          else if (part.getTypeName() != null) {
              this.qName = new QName(fault.getNamespaceURI(), part.getName());
          }
          else {
              this.qName = part.getElementName();
          }
      } // ctor
  
      public Message getMessage() {
          return message;
      } // getMessage
  
      public QName getXMLType() {
          return xmlType;
      } // getXMLType
  
      public Use getUse() {
          return use;
      } // getUse
  
      /**
       * Return the QName of a fault.  This method may return null if no parts
       * are in the fault message.
       *
       * If the part of the fault is a type, then the QName is
       * derived from the element name and the provided namespace
       * (this namespace SHOULD come from the binding).
       *
       * If the part of the fault is an element, then the QName is
       * the QName of the element, and the given namespace is ignored.
       */
      public QName getQName() {
          return qName;
      } // getQName
  
      /**
       * Convenience method for getting the local part of the QName.
       */
       public String getName() {
           return qName.getLocalPart();
       } // getName
  
      /**
       * It is assumed at this point that the fault message has only
       * 0 or 1 parts.  If 0, return null.  If 1, return it.
       */
      private Part getFaultPart() {
          // get the name of the part
          Map parts = message.getParts();
          // If no parts, skip it
          if (parts.size() == 0) {
              return null;
          }
          else {
              return (Part) parts.values().iterator().next();
          }
      }
  
      /**
       * Get the XML type (QName) for a Fault - look in the (single) fault
       * part for type="" or element="" - if type, return the QName.  If
       * element, return the reference type for the element.
       * 
       * @param fault the Fault to dig into
       * @param st the SymbolTable we're using
       * @return the XML type of the Fault's part, or null
       */ 
      private QName getFaultType(SymbolTable st, Part part) {
          if (part != null) {
              if (part.getTypeName() != null) {
                  return part.getTypeName();
              }
              // Literal, so get the element's type
              TypeEntry entry = st.getElement(part.getElementName());
              if (entry != null) {
                  return entry.getRefType().getQName();
              }
          }
          return null;
      }
  }
  
  
  
  
  1.12      +10 -25    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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JavaDefinitionWriter.java	8 Oct 2002 03:31:33 -0000	1.11
  +++ JavaDefinitionWriter.java	9 Oct 2002 20:51:29 -0000	1.12
  @@ -65,8 +65,8 @@
   import java.util.ArrayList;
   
   import javax.wsdl.Definition;
  -import javax.wsdl.Fault;
   import javax.wsdl.Import;
  +import javax.wsdl.Message;
   import javax.wsdl.Operation;
   import javax.wsdl.PortType;
   import javax.wsdl.BindingFault;
  @@ -75,12 +75,14 @@
   import javax.wsdl.extensions.soap.SOAPFault;
   import javax.xml.namespace.QName;
   
  +import org.apache.axis.utils.Messages;
  +
   import org.apache.axis.wsdl.gen.Generator;
   
  -import org.apache.axis.wsdl.symbolTable.SymbolTable;
  -import org.apache.axis.wsdl.symbolTable.MessageEntry;
   import org.apache.axis.wsdl.symbolTable.BindingEntry;
  -import org.apache.axis.utils.Messages;
  +import org.apache.axis.wsdl.symbolTable.FaultInfo;
  +import org.apache.axis.wsdl.symbolTable.MessageEntry;
  +import org.apache.axis.wsdl.symbolTable.SymbolTable;
   
   /**
    * This is Wsdl2java's Definition Writer.  
  @@ -125,8 +127,8 @@
           Iterator fi = faults.iterator();
           while (fi.hasNext()) {
               FaultInfo faultInfo = (FaultInfo) fi.next();
  -            Fault fault = faultInfo.fault;
  -            String name = Utils.getFullExceptionName(fault, symbolTable);
  +            Message message = faultInfo.getMessage();
  +            String name = Utils.getFullExceptionName(message, symbolTable);
               if (generatedFaults.contains(name)) {
                   continue;
               }
  @@ -135,8 +137,7 @@
               // Generate the 'Simple' Faults.
               // The complexType Faults are automatically handled
               // by JavaTypeWriter.
  -            MessageEntry me = symbolTable.getMessageEntry(
  -                fault.getMessage().getQName());
  +            MessageEntry me = symbolTable.getMessageEntry(message.getQName());
               boolean emitSimpleFault = true;
               if (me != null) {
                   Boolean complexTypeFault = (Boolean)
  @@ -151,8 +152,7 @@
                       JavaFaultWriter writer = 
                               new JavaFaultWriter(emitter, 
                                                   symbolTable, 
  -                                                faultInfo.fault, 
  -                                                faultInfo.soapFault); 
  +                                                faultInfo); 
                       // Go write the file
                       writer.generate();
                   } catch (DuplicateFileException dfe) {
  @@ -162,21 +162,6 @@
               }
           }
       } // writeFaults
  -
  -    /**
  -     * Holder structure for fault information
  -     */ 
  -    public static class FaultInfo {
  -        public FaultInfo(Fault fault, SOAPFault soapFault, QName xmlType) {
  -            this.fault = fault;
  -            this.soapFault = soapFault;
  -            this.xmlType = xmlType;
  -        }
  -
  -        public Fault fault;
  -        public SOAPFault soapFault;
  -        public QName xmlType;
  -    }
   
       /**
        * Collect all of the faults used in this definition.
  
  
  
  1.68      +8 -8      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.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- JavaDeployWriter.java	9 Oct 2002 19:06:33 -0000	1.67
  +++ JavaDeployWriter.java	9 Oct 2002 20:51:30 -0000	1.68
  @@ -82,8 +82,9 @@
   import org.apache.axis.utils.Messages;
   
   import org.apache.axis.wsdl.symbolTable.BindingEntry;
  -import org.apache.axis.wsdl.symbolTable.Element;
   import org.apache.axis.wsdl.symbolTable.CollectionTE;
  +import org.apache.axis.wsdl.symbolTable.Element;
  +import org.apache.axis.wsdl.symbolTable.FaultInfo;
   import org.apache.axis.wsdl.symbolTable.Parameter;
   import org.apache.axis.wsdl.symbolTable.Parameters;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
  @@ -479,19 +480,18 @@
           }
           if (faults != null) {
               for (Iterator iterator = faults.iterator(); iterator.hasNext();) {
  -                JavaDefinitionWriter.FaultInfo faultInfo = 
  -                        (JavaDefinitionWriter.FaultInfo) iterator.next();
  -                QName faultQName = Utils.getFaultQName(faultInfo.fault, 
  -                                                       faultInfo.soapFault);
  +                FaultInfo faultInfo = (FaultInfo) iterator.next();
  +                QName faultQName = faultInfo.getQName();
                   if (faultQName != null) {
  -                    String className = Utils.getFullExceptionName(faultInfo.fault, symbolTable);
  +                    String className = Utils.getFullExceptionName(
  +                            faultInfo.getMessage(), symbolTable);
                       pw.print("        <fault");
                       pw.print(" qname=\"" +
                                Utils.genQNameAttributeString(faultQName, "fns") + "\"");
                       pw.print(" class=\"" + className+ "\"");
                       pw.print(" type=\"" +
  -                             Utils.genQNameAttributeString(faultInfo.xmlType,
  -                                                           "tns") + "\"");
  +                             Utils.genQNameAttributeString(
  +                             faultInfo.getXMLType(), "tns") + "\"");
                       pw.println("/>");
                   }
               }
  
  
  
  1.16      +15 -19    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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JavaFaultWriter.java	8 Oct 2002 03:31:33 -0000	1.15
  +++ JavaFaultWriter.java	9 Oct 2002 20:51:30 -0000	1.16
  @@ -63,12 +63,15 @@
   import java.util.Iterator;
   import java.util.Collection;
   
  -import javax.wsdl.Fault;
   import javax.wsdl.BindingFault;
  +import javax.wsdl.Message;
   import javax.wsdl.PortType;
   import javax.wsdl.extensions.soap.SOAPFault;
   import javax.xml.namespace.QName;
   
  +import org.apache.axis.enum.Use;
  +
  +import org.apache.axis.wsdl.symbolTable.FaultInfo;
   import org.apache.axis.wsdl.symbolTable.Parameter;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
   
  @@ -79,21 +82,22 @@
    * faults that are complex types. 
    */
   public class JavaFaultWriter extends JavaClassWriter {
  -    private Fault fault;
  +    private Message faultMessage;
       private SymbolTable symbolTable;
  -    private SOAPFault soapFault;
  +    private boolean literal;
  +    private String faultName;
   
       /**
        * Constructor.
        */
       protected JavaFaultWriter(Emitter emitter, 
  -                              SymbolTable symbolTable, 
  -                              Fault fault, 
  -                              SOAPFault soapFault) {
  -        super(emitter, Utils.getFullExceptionName(fault, symbolTable), "fault");
  -        this.fault = fault;
  +                              SymbolTable symbolTable,
  +                              FaultInfo faultInfo) {
  +        super(emitter, Utils.getFullExceptionName(faultInfo.getMessage(),
  +                symbolTable), "fault");
  +        this.literal = faultInfo.getUse().equals(Use.LITERAL);
  +        this.faultMessage = faultInfo.getMessage();
           this.symbolTable = symbolTable;
  -        this.soapFault = soapFault;
       } // ctor
   
       /**
  @@ -109,18 +113,10 @@
       protected void writeFileBody(PrintWriter pw) throws IOException {
           Vector params = new Vector();
   
  -        boolean literal = false;
  -        // Have to get use information (literal/encoded) for fault from Binding.
  -        if (soapFault != null) {
  -            if ("literal".equalsIgnoreCase(soapFault.getUse())) {
  -                literal = true;
  -            }
  -        }
  -
           symbolTable.getParametersFromParts(params, 
  -                                fault.getMessage().getOrderedParts(null), 
  +                                faultMessage.getOrderedParts(null), 
                                   literal, 
  -                                fault.getName(), 
  +                                faultName, 
                                   null);
   
           // Write data members of the exception and getter methods for them
  
  
  
  1.28      +1 -1      xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- JavaGeneratorFactory.java	8 Oct 2002 03:31:33 -0000	1.27
  +++ JavaGeneratorFactory.java	9 Oct 2002 20:51:30 -0000	1.28
  @@ -935,7 +935,7 @@
               while (i.hasNext()) {
                   Fault fault = (Fault) i.next();
                   String exceptionName =
  -                  Utils.getFullExceptionName(fault, symbolTable);
  +                  Utils.getFullExceptionName(fault.getMessage(), symbolTable);
                   signature = signature + ", " + exceptionName;
               }
           }
  
  
  
  1.101     +7 -7      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.100
  retrieving revision 1.101
  diff -u -r1.100 -r1.101
  --- JavaStubWriter.java	9 Oct 2002 19:06:33 -0000	1.100
  +++ JavaStubWriter.java	9 Oct 2002 20:51:30 -0000	1.101
  @@ -60,6 +60,7 @@
   import org.apache.axis.wsdl.symbolTable.BindingEntry;
   import org.apache.axis.wsdl.symbolTable.CollectionTE;
   import org.apache.axis.wsdl.symbolTable.Element;
  +import org.apache.axis.wsdl.symbolTable.FaultInfo;
   import org.apache.axis.wsdl.symbolTable.Parameter;
   import org.apache.axis.wsdl.symbolTable.Parameters;
   import org.apache.axis.wsdl.symbolTable.SymbolTable;
  @@ -415,10 +416,9 @@
           }
           // For each fault, register its information
           for (Iterator faultIt = faults.iterator(); faultIt.hasNext();) {
  -            JavaDefinitionWriter.FaultInfo info = (JavaDefinitionWriter.FaultInfo) faultIt.next();
  -            
  -            Fault fault = info.fault;
  -            QName qname = Utils.getFaultQName(fault, info.soapFault);
  +            FaultInfo info = (FaultInfo) faultIt.next();
  +            QName qname = info.getQName();
  +            Message message = info.getMessage();
               
               // if no parts in fault, skip it!
               if (qname == null) {
  @@ -426,17 +426,17 @@
               }
               
               // Get the Exception class name
  -            String className = Utils.getFullExceptionName(fault, symbolTable);
  +            String className = Utils.getFullExceptionName(message, symbolTable);
               
               // Get the xmlType of the exception data
  -            QName xmlType = Utils.getFaultDataType(fault, symbolTable);
  +            QName xmlType = Utils.getFaultDataType(message, symbolTable);
               
               // output the registration API call
               pw.print("        _call.addFault(");
               pw.print( Utils.getNewQName(qname) + ", ");
               pw.print( className + ".class, ");
               pw.print( Utils.getNewQName(xmlType) + ", ");
  -            pw.print( Utils.isFaultComplex(fault, symbolTable));
  +            pw.print( Utils.isFaultComplex(message, symbolTable));
               pw.println(");");
           }
       }
  
  
  
  1.46      +2 -1      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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- JavaTestCaseWriter.java	8 Oct 2002 03:31:33 -0000	1.45
  +++ JavaTestCaseWriter.java	9 Oct 2002 20:51:30 -0000	1.46
  @@ -266,7 +266,8 @@
                       count++;
                       Fault f = (Fault) i.next();
                       pw.print("        catch (");
  -                    pw.print(Utils.getFullExceptionName(f, symbolTable));
  +                    pw.print(Utils.getFullExceptionName(
  +                            f.getMessage(), symbolTable));
                       pw.println(" e" + count + ") {");
                       pw.print("            ");
                       pw.println("throw new junit.framework.AssertionFailedError(\"" + f.getName() + " Exception caught: \" + e" + count + ");");
  
  
  
  1.62      +9 -16     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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- Utils.java	9 Oct 2002 20:10:16 -0000	1.61
  +++ Utils.java	9 Oct 2002 20:51:30 -0000	1.62
  @@ -75,7 +75,6 @@
   
   import javax.wsdl.BindingInput;
   import javax.wsdl.BindingOperation;
  -import javax.wsdl.Fault;
   import javax.wsdl.Input;
   import javax.wsdl.Message;
   import javax.wsdl.Operation;
  @@ -223,47 +222,41 @@
       }
   
       /**
  -     * Given a fault, return the fully qualified Java class name
  +     * Given a fault message, return the fully qualified Java class name
        * of the exception to be generated from this fault
        * 
  -     * @param fault The WSDL fault object
  +     * @param message The WSDL fault message
        * @param symbolTable the current symbol table
        * @return A Java class name for the fault
        */ 
  -    public static String getFullExceptionName(Fault fault, 
  +    public static String getFullExceptionName(Message faultMessage, 
                                                 SymbolTable symbolTable) {
  -        // Get the Message referenced in the message attribute of the fault.
  -        Message faultMessage = fault.getMessage();
           MessageEntry me = symbolTable.getMessageEntry(faultMessage.getQName()); 
           return (String) me.getDynamicVar(JavaGeneratorFactory.EXCEPTION_CLASS_NAME);
       } // getFullExceptionName
   
       /**
  -     * Given a fault, return the XML type of the exception data.
  +     * Given a fault message, return the XML type of the exception data.
        * 
  -     * @param fault The WSDL fault object
  +     * @param message The WSDL fault message object
        * @param symbolTable the current symbol table
        * @return A QName for the XML type of the data
        */ 
  -    public static QName getFaultDataType(Fault fault, 
  +    public static QName getFaultDataType(Message faultMessage, 
                                            SymbolTable symbolTable) {
  -        // Get the Message referenced in the message attribute of the fault.
  -        Message faultMessage = fault.getMessage();
           MessageEntry me = symbolTable.getMessageEntry(faultMessage.getQName()); 
           return (QName) me.getDynamicVar(JavaGeneratorFactory.EXCEPTION_DATA_TYPE);
       } // getFaultDataType
   
       /**
  -     * Given a fault, return TRUE if the fault is a complex type fault
  +     * Given a fault message, return TRUE if the fault is a complex type fault
        * 
  -     * @param fault The WSDL fault object
  +     * @param message The WSDL fault message object
        * @param symbolTable the current symbol table
        * @return A Java class name for the fault
        */ 
  -    public static boolean isFaultComplex(Fault fault, 
  +    public static boolean isFaultComplex(Message faultMessage, 
                                            SymbolTable symbolTable) {
  -        // Get the Message referenced in the message attribute of the fault.
  -        Message faultMessage = fault.getMessage();
           MessageEntry me = symbolTable.getMessageEntry(faultMessage.getQName()); 
           Boolean ret = (Boolean) me.getDynamicVar(JavaGeneratorFactory.COMPLEX_TYPE_FAULT);
           if (ret != null) {
  
  
  
  1.3       +0 -8      xml-axis/java/test/wsdl/header/header.wsdl
  
  Index: header.wsdl
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/wsdl/header/header.wsdl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- header.wsdl	9 Oct 2002 19:06:34 -0000	1.2
  +++ header.wsdl	9 Oct 2002 20:51:31 -0000	1.3
  @@ -41,9 +41,7 @@
       <wsdl:operation name="op1">
         <wsdl:input message="tns:op1Request"/>
         <wsdl:output message="tns:op1Response"/>
  -<!--
         <wsdl:fault name="op1Fault" message="tns:op1Fault"/>
  --->
       </wsdl:operation>
     </wsdl:portType>
   
  @@ -59,23 +57,19 @@
                        part="parm1"
                        use="literal"
                        namespace="urn:header.wsdl.test">
  -<!--
             <soap:headerfault message="tns:op1Fault"
                               part="message"
                               use="literal" 
                               namespace="urn:header.wsdl.test"/>
  --->
           </soap:header>
           <soap:header message="tns:op1Request"
                        part="header"
                        use="literal"
                        namespace="urn:header.wsdl.test">
  -<!--
             <soap:headerfault message="tns:op1Fault"
                               part="message"
                               use="literal" 
                               namespace="urn:header.wsdl.test"/>
  --->
           </soap:header>
         </wsdl:input>
         <wsdl:output>
  @@ -84,13 +78,11 @@
                      parts="header"
                      namespace="urn:header.wsdl.test"/>
   -->
  -<!--
           <soap:header message="tns:op1Response"
                        part="return"
                        use="literal"
                        namespace="urn:header.wsdl.test">
           </soap:header>
  --->
         </wsdl:output>
       </wsdl:operation>
     </wsdl:binding>