Glen, you say you have a low # of multithread threads that succeed.  How
many?  I get:

   [junit] Had 328 successes (of a possible 400)

and thereabouts (though I've also gotten as few as 40; don't know why).
There WILL be a certain # of failures because the test is just throwing
lots of calls simultaneously across the wire and the socket itself will
panic and throw back a certain # of those.  If there are too many failures,
then this test may not be testing anything of value.

Russell Butek
[EMAIL PROTECTED]


[EMAIL PROTECTED] on 04/01/2002 02:12:17 PM

Please respond to [EMAIL PROTECTED]

To:    [EMAIL PROTECTED]
cc:
Subject:    cvs commit: xml-axis/java/test/wsdl/multithread
       MultithreadTestCase.java



gdaniels    02/04/01 12:12:17

  Modified:    java/src/org/apache/axis/deployment/wsdd WSDDService.java
               java/src/org/apache/axis/description OperationDesc.java
                        ServiceDesc.java
               java/src/org/apache/axis/encoding
                        SerializationContextImpl.java
               java/src/org/apache/axis/encoding/ser BeanSerializer.java
               java/src/org/apache/axis/providers/java JavaProvider.java
               java/src/org/apache/axis/wsdl Skeleton.java
               java/src/org/apache/axis/wsdl/fromJava
                        BuilderPortTypeClassRep.java ClassRep.java
                        DefaultBuilderPortTypeClassRep.java Emitter.java
                        ExceptionRep.java Types.java
               java/src/org/apache/axis/wsdl/toJava JavaSkelWriter.java
               java/test/wsdl/multithread MultithreadTestCase.java
  Added:       java/src/org/apache/axis/description FaultDesc.java
  Log:
  * Most of the switchover for the Java2WSDL Emitter to use
  org.apache.axis.
    description.* metadata has been done and works.

  * Skeletons are now emitted using org.apache.axis.description.* metadata,
    and the runtime updated to use that information if available.

  * Added FaultDesc for faults, disallowedMethods, SOAPAction, and
    stopClasses to
    metadata.

  * When we're using an implementation class, all the methods that could
    possibly
    be available will be in ancestor classes (since they must implement all
    the
    appropriate interfaces).  If we're using Java2WSDL to point at an
    Interface,
    however, we need to walk the interface's interfaces to correctly catch
    all
    the parental methods.  Revamp the inheritance code to handle this, as
    well as
    being more correct about superclasses.

  * We need the ServiceDesc to "resolve" completely at various points, for
    instance:
       1) When a listing of ServiceDescs is requested from an
       EngineConfiguration
       2) When a service is instantiated in the engine, either for a call
       or
          for automatic WSDL generation
       3) When Java2WSDL is used

    Basically the only variable in these situations is what classloader to
    use
    to resolve the class name.  I'd like to have a single place where we do
    this,
    but it should be the RIGHT place.

    WARNING : Right now the Class.forName() call in WSDDService is probably
    NOT
    going to work in servlet engines.  I'd like to get this resolved ASAP.

  * Clean up various JavaDoc inconsistencies (go IDEA!)

  * Print TypeMapping, not SerializationContextImpl, in debug message

  * Count successful invocations for the multi-threaded test case, so we
    can see
    what's going on.  Also put the number of threads into a variable to
    make it
    easier to tweak.  I think the very low # of successes (for me anyway)
    warrants some investigation.

  Revision  Changes    Path
  1.49      +2 -2
  xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java

  Index: WSDDService.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v

  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- WSDDService.java  29 Mar 2002 00:05:42 -0000    1.48
  +++ WSDDService.java  1 Apr 2002 20:12:16 -0000     1.49
  @@ -182,8 +182,8 @@
   // This is likely no good - need to figure out which classloader to use
   // and load the class when needed (for instance when the ServiceDesc is
   // requested....  --Glen
  -//                Class cls = Class.forName(className);
  -//                desc.setImplClass(cls);
  +                Class cls = Class.forName(className);
  +                desc.setImplClass(cls);
                   initTMR();
                   String encStyle = Constants.URI_SOAP_ENC;
                   desc.setTypeMapping
                   ((TypeMapping)tmr.getTypeMapping(encStyle));



  1.7       +26 -0
  xml-axis/java/src/org/apache/axis/description/OperationDesc.java

  Index: OperationDesc.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/description/OperationDesc.java,v

  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- OperationDesc.java      31 Mar 2002 04:15:31 -0000    1.6
  +++ OperationDesc.java      1 Apr 2002 20:12:16 -0000     1.7
  @@ -100,6 +100,12 @@
       /** The number of "in" params (i.e. IN or INOUT) for this operation
       */
       private int numInParams = 0;

  +    /** A unique SOAPAction value for this operation */
  +    private String soapAction = null;
  +
  +    /** Faults for this operation */
  +    private ArrayList faults = null;
  +
       /**
        * Default constructor.
        */
  @@ -171,6 +177,14 @@
           this.parent = parent;
       }

  +    public String getSoapAction() {
  +        return soapAction;
  +    }
  +
  +    public void setSoapAction(String soapAction) {
  +        this.soapAction = soapAction;
  +    }
  +
       public void setStyle(int style)
       {
           this.style = new Integer(style);
  @@ -299,6 +313,18 @@
               }
           }
           return result;
  +    }
  +
  +    public void addFault(FaultDesc fault)
  +    {
  +        if (faults == null)
  +            faults = new ArrayList();
  +        faults.add(fault);
  +    }
  +
  +    public ArrayList getFaults()
  +    {
  +        return faults;
       }
   }




  1.11      +98 -11
  xml-axis/java/src/org/apache/axis/description/ServiceDesc.java

  Index: ServiceDesc.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/description/ServiceDesc.java,v

  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ServiceDesc.java  31 Mar 2002 04:15:31 -0000    1.10
  +++ ServiceDesc.java  1 Apr 2002 20:12:16 -0000     1.11
  @@ -63,8 +63,10 @@
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  +import java.util.List;
   import java.lang.reflect.Method;
   import java.lang.reflect.InvocationTargetException;
  +import java.lang.reflect.Field;

   /**
    * A ServiceDesc is an abstract description of a service.
  @@ -91,6 +93,9 @@
       /** null allows everything, an empty ArrayList allows nothing */
       private ArrayList allowedMethods = null;

  +    /** List if disallowed methods */
  +    private List disallowedMethods = null;
  +
       /** Style */
       private int style = STYLE_RPC;

  @@ -125,6 +130,9 @@
       /** Cached copy of the skeleton "getParameterDescStatic" method */
       private Method skelMethod = null;

  +    /** Classes at which we should stop looking up the inheritance chain
  */
  +    private ArrayList stopClasses = null;
  +
       /** Lookup caches */
       private HashMap name2OperationsMap = null;
       private HashMap qname2OperationMap = null;
  @@ -209,6 +217,22 @@
           this.name = name;
       }

  +    public ArrayList getStopClasses() {
  +        return stopClasses;
  +    }
  +
  +    public void setStopClasses(ArrayList stopClasses) {
  +        this.stopClasses = stopClasses;
  +    }
  +
  +    public List getDisallowedMethods() {
  +        return disallowedMethods;
  +    }
  +
  +    public void setDisallowedMethods(List disallowedMethods) {
  +        this.disallowedMethods = disallowedMethods;
  +    }
  +
       public void addOperationDesc(OperationDesc operation)
       {
           operations.add(operation);
  @@ -236,7 +260,7 @@

       public OperationDesc [] getOperationsByName(String methodName)
       {
  -        getSyncedOperationsForName(methodName);
  +        getSyncedOperationsForName(implClass, methodName);

           if (name2OperationsMap == null)
               return null;
  @@ -259,7 +283,7 @@
           // If we need to load up operations from introspection data, do
           it.
           // This returns fast if we don't need to do anything, so it's
           not very
           // expensive.
  -        getSyncedOperationsForName(methodName);
  +        getSyncedOperationsForName(implClass, methodName);

           if (name2OperationsMap == null)
               return null;
  @@ -375,8 +399,11 @@

           // Didn't find a match.  Try the superclass, if appropriate
           Class superClass = implClass.getSuperclass();
  -        if (!superClass.getName().startsWith("java.") &&
  -                !superClass.getName().startsWith("javax.")) {
  +        if (superClass != null &&
  +                !superClass.getName().startsWith("java.") &&
  +                !superClass.getName().startsWith("javax.") &&
  +                (stopClasses == null ||
  +                          !stopClasses.contains(superClass.getName())))
  {
               syncOperationToClass(oper, superClass);
           }
       }
  @@ -387,18 +414,46 @@
        */
       public void loadServiceDescByIntrospection()
       {
  +        loadServiceDescByIntrospection(implClass, true);
  +
  +        // Setting this to null means there is nothing more to do, and
  it
  +        // avoids future string compares.
  +        completedNames = null;
  +    }
  +    /**
  +     * Fill in a service description by introspecting the implementation
  +     * class.
  +     */
  +    public void loadServiceDescByIntrospection(Class implClass, boolean
  searchParents)
  +    {
           if (implClass == null)
               return;

           Method [] methods = implClass.getDeclaredMethods();

           for (int i = 0; i < methods.length; i++) {
  -            getSyncedOperationsForName(methods[i].getName());
  +            getSyncedOperationsForName(implClass, methods[i].getName());
           }

  -        // Setting this to null means there is nothing more to do, and
  it
  -        // avoids future string compares.
  -        completedNames = null;
  +        if (implClass.isInterface()) {
  +            Class [] superClasses = implClass.getInterfaces();
  +            for (int i = 0; i < superClasses.length; i++) {
  +                Class superClass = superClasses[i];
  +                if (stopClasses == null ||
  +                        !stopClasses.contains(superClass.getName())) {
  +                    loadServiceDescByIntrospection(superClass, true);
  +                }
  +            }
  +        } else {
  +            Class superClass = implClass.getSuperclass();
  +            if (superClass != null &&
  +                    !superClass.getName().startsWith("java.") &&
  +                    !superClass.getName().startsWith("javax.") &&
  +                    (stopClasses == null ||
  +                        !stopClasses.contains(superClass.getName()))) {
  +                loadServiceDescByIntrospection(superClass, true);
  +            }
  +        }
       }

       /**
  @@ -418,7 +473,7 @@
        * Makes sure we have completely synchronized OperationDescs with
        * the implementation class.
        */
  -    private void getSyncedOperationsForName(String methodName)
  +    private void getSyncedOperationsForName(Class implClass, String
  methodName)
       {
           // If we have no implementation class, don't worry about it
           (we're
           // probably on the client)
  @@ -434,6 +489,10 @@
               !allowedMethods.contains(methodName))
               return;

  +        if ((disallowedMethods != null) &&
  +            disallowedMethods.contains(methodName))
  +            return;
  +
           // If we're a skeleton class, make sure we don't already have
           any
           // OperationDescs for this name (as that might cause conflicts),
           // then load them up from the Skeleton class.
  @@ -520,7 +579,8 @@
           }

           Class superClass = implClass.getSuperclass();
  -        if (!superClass.getName().startsWith("java.") &&
  +        if (superClass != null &&
  +                !superClass.getName().startsWith("java.") &&
                   !superClass.getName().startsWith("javax.")) {
               createOperationsForName(superClass, methodName);
           }
  @@ -546,7 +606,8 @@
           OperationDesc operation = new OperationDesc();
           operation.setName(method.getName());
           operation.setMethod(method);
  -        operation.setReturnClass(method.getReturnType());
  +        Class retClass = method.getReturnType();
  +        operation.setReturnClass(retClass);
           operation.setReturnType(tm.getTypeQName(method.getReturnType
           ()));

           Class [] paramTypes = method.getParameterTypes();
  @@ -577,6 +638,32 @@
                   paramDesc.setTypeQName(tm.getTypeQName(type));
               }
               operation.addParameter(paramDesc);
  +        }
  +
  +        // Create Exception Types
  +        Class[] exceptionTypes = new Class[method.getExceptionTypes
  ().length];
  +        exceptionTypes = method.getExceptionTypes();
  +
  +        for (int i=0; i < exceptionTypes.length; i++) {
  +            // Every remote method declares a java.rmi.RemoteException
  +            if (exceptionTypes[i] != java.rmi.RemoteException.class) {
  +                Field[] f = exceptionTypes[i].getDeclaredFields();
  +                ArrayList exceptionParams = new ArrayList();
  +                for (int j = 0; j < f.length; j++) {
  +                    QName qname = new QName("", f[j].getName());
  +                    QName typeQName = tm.getTypeQName(f[j].getType());
  +                    ParameterDesc param = new ParameterDesc(qname,
  +
  ParameterDesc.IN,
  +                                                            typeQName);
  +                    param.setJavaType(f[j].getType());
  +                    exceptionParams.add(param);
  +                }
  +                String pkgAndClsName = exceptionTypes[i].getName();
  +                FaultDesc fault = new FaultDesc();
  +                fault.setName(pkgAndClsName);
  +                fault.setParameters(exceptionParams);
  +                operation.addFault(fault);
  +            }
           }

           addOperationDesc(operation);



  1.1
  xml-axis/java/src/org/apache/axis/description/FaultDesc.java

  Index: FaultDesc.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 [EMAIL PROTECTED]
   *
   * 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.description;

  import javax.xml.rpc.namespace.QName;
  import java.util.ArrayList;

  /**
   *
   * @author Glen Daniels ([EMAIL PROTECTED])
   */
  public class FaultDesc {
      private QName qname;
      private ArrayList parameters;

      public QName getQName() {
          return qname;
      }

      public void setQName(QName name) {
          this.qname = name;
      }

      public String getName()
      {
          if (qname != null)
              return qname.getLocalPart();
          return null;
      }

      public void setName(String name)
      {
          qname = new QName("", name);
      }

      public ArrayList getParameters() {
          return parameters;
      }

      public void setParameters(ArrayList parameters) {
          this.parameters = parameters;
      }
  }



  1.15      +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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SerializationContextImpl.java 31 Mar 2002 23:09:33 -0000    1.14
  +++ SerializationContextImpl.java 1 Apr 2002 20:12:16 -0000     1.15
  @@ -902,7 +902,7 @@
               }

               throw new IOException(JavaUtils.getMessage("noSerializer00",
  -                    value.getClass().getName(), "" + this));
  +                    value.getClass().getName(), "" + tm));
           }
           // !!! Write out a generic null, or get type info from somewhere
           else?
       }



  1.24      +13 -32
  xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java

  Index: BeanSerializer.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v

  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- BeanSerializer.java     28 Mar 2002 18:41:16 -0000    1.23
  +++ BeanSerializer.java     1 Apr 2002 20:12:16 -0000     1.24
  @@ -55,51 +55,33 @@

   package org.apache.axis.encoding.ser;

  -import org.xml.sax.Attributes;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.helpers.AttributesImpl;
  -
  -import javax.xml.rpc.namespace.QName;
  -import java.io.IOException;
  -
  +import org.apache.axis.AxisFault;
   import org.apache.axis.Constants;
  -import org.apache.axis.encoding.Serializer;
  -import org.apache.axis.encoding.SerializerFactory;
  -import org.apache.axis.encoding.SerializationContext;
  -import org.apache.axis.encoding.Deserializer;
  -import org.apache.axis.encoding.DeserializerFactory;
  -import org.apache.axis.encoding.DeserializationContext;
  -import org.apache.axis.encoding.DeserializerImpl;
   import org.apache.axis.InternalException;
  -import org.apache.axis.AxisFault;
  -import org.apache.axis.description.TypeDesc;
   import org.apache.axis.description.FieldDesc;
  +import org.apache.axis.description.TypeDesc;
  +import org.apache.axis.encoding.SerializationContext;
  +import org.apache.axis.encoding.Serializer;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.wsdl.fromJava.ClassRep;
   import org.apache.axis.wsdl.fromJava.FieldRep;
   import org.apache.axis.wsdl.fromJava.Types;
  -import org.apache.axis.wsdl.toJava.Utils;
  -
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -
  -import java.io.Serializable;
  -import java.lang.reflect.Method;
  -import java.lang.reflect.InvocationTargetException;
  -import java.lang.reflect.Modifier;
  -import java.beans.IntrospectionException;
  -
   import org.w3c.dom.Element;
  -import org.w3c.dom.Document;
  +import org.xml.sax.Attributes;
  +import org.xml.sax.helpers.AttributesImpl;

  +import javax.xml.rpc.namespace.QName;
   import java.beans.Introspector;
   import java.beans.PropertyDescriptor;
  -import java.io.ObjectStreamField;
  +import java.io.IOException;
   import java.io.Serializable;
  -
  -import java.util.HashMap;
  +import java.lang.reflect.InvocationTargetException;
  +import java.lang.reflect.Method;
  +import java.lang.reflect.Modifier;
  +import java.util.List;
   import java.util.Vector;
  -import java.util.Iterator;

   /**
    * General purpose serializer/deserializerFactory for an arbitrary java
    bean.
  @@ -305,7 +287,7 @@
           // See if there is a super class, stop if we hit a stop class
           Element e = null;
           Class superClass = javaType.getSuperclass();
  -        Vector stopClasses = types.getStopClasses();
  +        List stopClasses = types.getStopClasses();
           if (superClass != null &&
                   superClass != java.lang.Object.class &&
                   (stopClasses == null ||
  @@ -437,7 +419,6 @@
        * attribute list
        *
        * @param value the object we are serializing
  -     * @param pd the properties of this class
        * @return attributes for this element, null if none
        */
       protected Attributes getObjectAttributes(Object value,



  1.46      +1 -0
  xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java

  Index: JavaProvider.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v

  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- JavaProvider.java 25 Mar 2002 04:44:02 -0000    1.45
  +++ JavaProvider.java 1 Apr 2002 20:12:17 -0000     1.46
  @@ -325,6 +325,7 @@
               emitter.setAllowedMethods(allowedMethods);
               emitter.setIntfNamespace(url);
               emitter.setLocationUrl(url);
  +            emitter.setServiceDesc(msgContext.getService
               ().getServiceDescription());
               emitter.setTypeMapping
               ((TypeMapping)msgContext.getTypeMappingRegistry().
                                      getTypeMapping(Constants.URI_CURRENT_SOAP_ENC));

               emitter.setDefaultTypeMapping
               ((TypeMapping)msgContext.getTypeMappingRegistry().



  1.5       +0 -24     xml-axis/java/src/org/apache/axis/wsdl/Skeleton.java

  Index: Skeleton.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/Skeleton.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Skeleton.java     13 Mar 2002 19:50:58 -0000    1.4
  +++ Skeleton.java     1 Apr 2002 20:12:17 -0000     1.5
  @@ -61,28 +61,4 @@
    * Interface for WSDL2Java generated skeletons
    */
   public interface Skeleton {
  -    /**
  -     * Used to return the name of the n-th parameter of the specified
  -     * operation.  Use n=-1 to get the return value.
  -     * Returns null if problems occur or the parameter is not known.
  -     */
  -    public QName getParameterName(String operationName, int n);
  -
  -    /**
  -     * Note: The implementor should also provide a static version of the
  -     * above method named getParameterNameStatic
  -     */
  -
  -    /**
  -     * Used to return the mode of the n-th parameter of the specified
  -     * operation.  Use -1 to get the return mode.
  -     * Returns null if problems occur or the parameter is not known.
  -     */
  -    public ParameterMode getParameterMode(String operationName, int n);
  -
  -    /**
  -     * Note: The implementor should also provide a static version of the
  -     * above method named getParameterModeStatic
  -     */
  -
   }



  1.4       +2 -1
  xml-axis/java/src/org/apache/axis/wsdl/fromJava/BuilderPortTypeClassRep.java


  Index: BuilderPortTypeClassRep.java
  ===================================================================
  RCS file:
  
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/BuilderPortTypeClassRep.java,v

  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BuilderPortTypeClassRep.java  1 Feb 2002 22:46:13 -0000     1.3
  +++ BuilderPortTypeClassRep.java  1 Apr 2002 20:12:17 -0000     1.4
  @@ -55,6 +55,7 @@
   package org.apache.axis.wsdl.fromJava;

   import java.util.Vector;
  +import java.util.List;

   /**
    * BuilderPortTypeClassRep:
  @@ -77,7 +78,7 @@
        * @param implClass  An optional implClass can be passed in that
        implements/extends cls.
        *                   The purpose of the implClass is to find method
        parameter names.
        **/
  -    public ClassRep build(Class cls, boolean inhMethods, Vector
  stopClasses, Class implClass);
  +    public ClassRep build(Class cls, boolean inhMethods, List
  stopClasses, Class implClass);

       /**
        * Returns a list of MethodReps to be used for portType operation
        processing.



  1.26      +6 -9
  xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java

  Index: ClassRep.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ClassRep.java     28 Mar 2002 15:21:46 -0000    1.25
  +++ ClassRep.java     1 Apr 2002 20:12:17 -0000     1.26
  @@ -69,6 +69,7 @@
   import java.lang.reflect.Modifier;
   import java.util.HashMap;
   import java.util.Vector;
  +import java.util.List;
   import java.util.HashMap;

   import org.apache.axis.utils.JavaUtils;
  @@ -160,7 +161,7 @@
       private Vector   _methods    = new Vector();
       private Vector   _fields     = new Vector();
       private HashMap  _fieldNames = new HashMap();
  -    private Vector   _stopList    = null;
  +    private List     _stopList    = null;

       /**
        * Constructor
  @@ -182,13 +183,13 @@
        *                   class that implements or extends cls.  The
        *                   implClass is used to obtain parameter names.
        */
  -    public ClassRep(Class cls, boolean inhMethods, Vector stopList) {
  +    public ClassRep(Class cls, boolean inhMethods, List stopList) {
           init(cls, inhMethods, stopList, null);
       }
  -    public ClassRep(Class cls, boolean inhMethods, Vector stopList,
  Class implClass) {
  +    public ClassRep(Class cls, boolean inhMethods, List stopList, Class
  implClass) {
           init(cls, inhMethods, stopList, implClass);
       }
  -    protected void init(Class cls, boolean inhMethods, Vector stopList,
  Class implClass) {
  +    protected void init(Class cls, boolean inhMethods, List stopList,
  Class implClass) {
           _name = cls.getName();
           _isInterface = cls.isInterface();
           _modifiers = cls.getModifiers();
  @@ -235,9 +236,7 @@
        * @param inhMethods if true, then the methods array will contain
        *                   methods declared and/or inherited else only
        *                   the declared methods are put in the list
  -     * @param stopList An optional vector of class names which if
  inhMethods
  -     *                    is true, will stop the inheritence search if
  encountered.
  -     * @param implClass  This is an optional parameter which is a
  +     * @param implClass  This is an optional parameter which is a
        *                   class that implements or extends cls.  The
        *                   implClass is used to obtain parameter names.
        */
  @@ -442,7 +441,6 @@
        * @param method is the Method to search.
        * @param implClass  If the first search fails, the corresponding
        *                   Method in this class is searched.
  -     * @param types  are the parameter types after converting Holders.
        * @return array of Strings which represent the return name followed
        by parameter names
        */
       protected String[] getParameterNames(Method method, Class implClass)
  {
  @@ -526,7 +524,6 @@
        * @param method is the Method to search.
        * @param implClass  If the first search fails, the corresponding
        *                   Method in this class is searched.
  -     * @param types  are the parameter types after converting Holders.
        * @return array of Strings which represent the return mode followed
        by parameter modes
        */
       protected ParameterMode[] getParameterModes(Method method, Class
       implClass) {



  1.4       +2 -1
  xml-axis/java/src/org/apache/axis/wsdl/fromJava/DefaultBuilderPortTypeClassRep.java


  Index: DefaultBuilderPortTypeClassRep.java
  ===================================================================
  RCS file:
  
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/DefaultBuilderPortTypeClassRep.java,v

  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultBuilderPortTypeClassRep.java 1 Feb 2002 22:46:13 -0000     1.3
  +++ DefaultBuilderPortTypeClassRep.java 1 Apr 2002 20:12:17 -0000     1.4
  @@ -55,6 +55,7 @@
   package org.apache.axis.wsdl.fromJava;

   import java.util.Vector;
  +import java.util.List;

   /**
    * DefaultBuilderPortTypeClassRep:
  @@ -80,7 +81,7 @@
        * @param implClass  An optional implClass can be passed in that
        implements/extends cls.
        *                   The purpose of the implClass is to find method
        parameter names.
        **/
  -    public ClassRep build(Class cls, boolean inhMethods, Vector
  stopClasses, Class implClass) {
  +    public ClassRep build(Class cls, boolean inhMethods, List
  stopClasses, Class implClass) {
           // Constructs a default ClassRep from the class
           // The Java2WSDL code examines the names/methods/params in
           ClassRep (and its super classes)
           // when constructing complexTypes.  So if you want to change the
           WSDL



  1.27      +222 -238
  xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java

  Index: Emitter.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Emitter.java      28 Mar 2002 15:21:47 -0000    1.26
  +++ Emitter.java      1 Apr 2002 20:12:17 -0000     1.27
  @@ -67,10 +67,11 @@
   import com.ibm.wsdl.extensions.soap.SOAPOperationImpl;

   import org.apache.axis.Constants;
  -import org.apache.axis.MessageContext;
  -import org.apache.axis.encoding.TypeMapping;
  -import org.apache.axis.encoding.DefaultTypeMappingImpl;
  -import org.apache.axis.encoding.DefaultSOAP12TypeMappingImpl;
  +import org.apache.axis.description.OperationDesc;
  +import org.apache.axis.description.ServiceDesc;
  +import org.apache.axis.description.ParameterDesc;
  +import org.apache.axis.description.FaultDesc;
  +import org.apache.axis.encoding.*;
   import org.apache.axis.utils.XMLUtils;
   import org.w3c.dom.Document;

  @@ -96,17 +97,10 @@
   import java.io.File;
   import java.io.FileOutputStream;
   import java.io.StringWriter;
  -import java.lang.reflect.Method;
  -import java.lang.reflect.Modifier;
  -import java.util.ArrayList;
  -import java.util.List;
  -import java.util.Map;
  -import java.util.StringTokenizer;
  -import java.util.Vector;
  -import java.util.HashMap;
  +import java.util.*;

   /**
  - * This class emits WSDL from Java classes.  It is used by the ?WSDL
  + * This class emits WSDL from Java classes.  It is used by the ?WSDL
    * Axis browser function and Java2WSDL commandline utility.
    * See Java2WSDL and Java2WSDLFactory for more information.
    *
  @@ -118,7 +112,7 @@
       public static final int MODE_ALL = 0;
       public static final int MODE_INTERFACE = 1;
       public static final int MODE_IMPLEMENTATION = 2;
  -
  +
       public static final int MODE_RPC = 0;
       public static final int MODE_DOCUMENT = 1;

  @@ -126,7 +120,7 @@
       private Class implCls;                 // Optional implementation
       class
       private Vector allowedMethods = null;  // Names of methods to
       consider
       private Vector disallowedMethods = null; // Names of methods to
       exclude
  -    private Vector stopClasses = null;// class names which halt
  inheritace searches
  +    private ArrayList stopClasses = null;// class names which halt
  inheritace searches
       private boolean useInheritedMethods = false;
       private String intfNS;
       private String implNS;
  @@ -138,19 +132,21 @@
       private String description;
       private int mode = MODE_RPC;
       private TypeMapping tm = null;        // Registered type mapping
  -    private TypeMapping defaultTM = null; // Default TM
  +    private TypeMapping defaultTM = null; // Default TM
       private Namespaces namespaces;
       private Map exceptionMsg = null;

       private ArrayList encodingList;
  -    private Types types;
  +    private Types types;
       private String clsName;
       private String portTypeName;
  -
  +
  +    private ServiceDesc serviceDesc;
  +
       private Java2WSDLFactory factory;  // Factory for obtaining user
       extensions

       /**
  -     * Construct Emitter.
  +     * Construct Emitter.
        * Set the contextual information using set* methods
        * Invoke emit to emit the code
        */
  @@ -161,10 +157,10 @@
       }

       /**
  -     * Generates WSDL documents for a given <code>Class</code>
  +     * Generates WSDL documents for a given <code>Class</code>
        *
  -     * @param filename1  interface WSDL
  -     * @param filename2  implementation WSDL
  +     * @param filename1  interface WSDL
  +     * @param filename2  implementation WSDL
        * @throws Exception
        */
       public void emit(String filename1, String filename2) throws
  Exception {
  @@ -180,13 +176,13 @@
               filename2 = getServicePortName() + "_implementation.wsdl";
           }

  -        // Write out the interface def
  +        // Write out the interface def
           Document doc = WSDLFactory.newInstance().
               newWSDLWriter().getDocument(intf);
           types.insertTypesFragment(doc);
           prettyDocumentToFile(doc, filename1);

  -        // Write out the implementation def
  +        // Write out the implementation def
           doc = WSDLFactory.newInstance().newWSDLWriter
           ().getDocument(impl);
           prettyDocumentToFile(doc, filename2);
       }
  @@ -194,7 +190,7 @@
       /**
        * Generates a complete WSDL document for a given <code>Class</code>
        *
  -     * @param filename  WSDL
  +     * @param filename  WSDL
        * @throws Exception
        */
       public void emit(String filename) throws Exception {
  @@ -202,17 +198,28 @@
       }

       /**
  -     * Generates a WSDL document for a given <code>Class</code>.
  -     * The WSDL generated is controlled by the mode parameter
  +     * Generates a WSDL document for a given <code>Class</code>.
  +     * The WSDL generated is controlled by the mode parameter
        * mode 0: All
        * mode 1: Interface
        * mode 2: Implementation
  -     *
  -     * @param mode generation mode - all, interface, implementation
  -     * @return Document
  +     *
  +     * @param mode generation mode - all, interface, implementation
  +     * @return Document
        * @throws Exception
        */
       public Document emit(int mode) throws Exception {
  +        if (serviceDesc == null) {
  +            serviceDesc = new ServiceDesc();
  +            serviceDesc.setImplClass(cls);
  +            //serviceDesc.setStyle();
  +            TypeMappingRegistry tmr = new TypeMappingRegistryImpl();
  +            serviceDesc.setTypeMapping
  ((TypeMapping)tmr.getDefaultTypeMapping());
  +        }
  +
  +        serviceDesc.setStopClasses(stopClasses);
  +        serviceDesc.setDisallowedMethods(disallowedMethods);
  +
           Document doc = null;
           Definition def = null;
           switch (mode) {
  @@ -234,7 +241,7 @@
                       newWSDLWriter().getDocument(def);
                   break;
               default:
  -                throw new Exception ("unrecognized output WSDL mode");
  +                throw new Exception ("unrecognized output WSDL mode");
           }

           // Return the document
  @@ -243,13 +250,13 @@

       /**
        * Generates a String containing the WSDL for a given
        <code>Class</code>.
  -     * The WSDL generated is controlled by the mode parameter
  +     * The WSDL generated is controlled by the mode parameter
        * mode 0: All
        * mode 1: Interface
        * mode 2: Implementation
  -     *
  -     * @param mode generation mode - all, interface, implementation
  -     * @return String
  +     *
  +     * @param mode generation mode - all, interface, implementation
  +     * @return String
        * @throws Exception
        */
       public String emitToString(int mode) throws Exception {
  @@ -261,13 +268,13 @@

       /**
        * Generates a WSDL document for a given <code>Class</code>.
  -     * The WSDL generated is controlled by the mode parameter
  +     * The WSDL generated is controlled by the mode parameter
        * mode 0: All
        * mode 1: Interface
        * mode 2: Implementation
  -     *
  +     *
        * @param filename  WSDL
  -     * @param mode generation mode - all, interface, implementation
  +     * @param mode generation mode - all, interface, implementation
        * @throws Exception
        */
       public void emit(String filename, int mode) throws Exception {
  @@ -302,13 +309,13 @@
       public Definition getWSDL() throws Exception {
           // Invoke the init() method to ensure configuration is setup
           init();
  -
  +
           // Create a definition
           Definition def = WSDLFactory.newInstance().newDefinition();

           // Write interface header
           writeDefinitions(def, intfNS);
  -        types = new Types(def, tm, defaultTM, namespaces,
  +        types = new Types(def, tm, defaultTM, namespaces,
                             intfNS, factory, stopClasses);
           Binding binding = writeBinding(def, true);
           writePortType(def, binding);
  @@ -332,7 +339,7 @@

           // Write interface header
           writeDefinitions(def, intfNS);
  -        types = new Types(def, tm, defaultTM, namespaces,
  +        types = new Types(def, tm, defaultTM, namespaces,
                             intfNS, factory, stopClasses);
           Binding binding = writeBinding(def, true);
           writePortType(def, binding);
  @@ -362,7 +369,7 @@
       }
       /**
        * Invoked prior to building a definition to ensure parms
  -     * and data are set up.
  +     * and data are set up.
        * @throws Exception
        */
       private void init() throws Exception {
  @@ -388,12 +395,12 @@
                           name = name.substring(name.lastIndexOf('/') +
                       1);
                       } else if (name.lastIndexOf('\\') > 0) {
                           name = name.substring(name.lastIndexOf('\\') +
  1);
  -                    } else {
  +                    } else {
                           name = null;
                       }
                       // if we got the name from the location, strip .jws
                       from it
                       if (name != null && name.endsWith(".jws") ) {
  -                        name = name.substring(0,
  +                        name = name.substring(0,
                                                 (name.length() -
                       ".jws".length()));
                       }
                   }
  @@ -402,12 +409,12 @@
                   }
                   setServicePortName(name);
               }
  -
  +
               encodingList = new ArrayList();
               encodingList.add(Constants.URI_CURRENT_SOAP_ENC);
  -

  -            // We want to produce valid SOAP 1.2 JAX-RPC
  +
  +            // We want to produce valid SOAP 1.2 JAX-RPC
               // translations, so make sure that the default type mapping
               // is for SOAP 1.2.
               if (defaultTM == null ||
  @@ -429,7 +436,7 @@
       }

       /**
  -     * Create the definition header information.
  +     * Create the definition header information.
        *
        * @param def  <code>Definition</code>
        * @param tns  target namespace
  @@ -454,7 +461,7 @@

           def.addNamespace(Constants.NSPREFIX_SOAP_ENC,
                            Constants.URI_CURRENT_SOAP_ENC);
  -        namespaces.putPrefix(Constants.URI_CURRENT_SOAP_ENC,
  +        namespaces.putPrefix(Constants.URI_CURRENT_SOAP_ENC,
                                Constants.NSPREFIX_SOAP_ENC);

           def.addNamespace(Constants.NSPREFIX_SCHEMA_XSD,
  @@ -464,11 +471,11 @@
       }

      /**
  -     * Create and add an import
  +     * Create and add an import
        *
        * @param def  <code>Definition</code>
        * @param tns  target namespace
  -     * @param loc  target location
  +     * @param loc  target location
        * @throws Exception
        */
       private void writeImport(Definition def, String tns, String loc)
  @@ -482,7 +489,7 @@
       }

       /**
  -     * Create the binding.
  +     * Create the binding.
        *
        * @param def  <code>Definition</code>
        * @param add  true if binding should be added to the def
  @@ -509,17 +516,16 @@
       }

       /**
  -     * Create the service.
  +     * Create the service.
        *
  -     * @param def
  -     * @param binding
  -     * @throws Exception
  +     * @param def
  +     * @param binding
        */
       private void writeService(Definition def, Binding binding) {

           Service service = def.createService();

  -        service.setQName(new javax.wsdl.QName(implNS,
  +        service.setQName(new javax.wsdl.QName(implNS,
                                                 getServiceElementName()));

           def.addService(service);
  @@ -539,13 +545,13 @@
           service.addPort(port);
       }

  -    /** Create a PortType
  +    /** Create a PortType
        *
  -     * @param def
  -     * @param binding
  +     * @param def
  +     * @param binding
        * @throws Exception
        */
  -    private void writePortType(Definition def, Binding binding)
  +    private void writePortType(Definition def, Binding binding)
           throws Exception{

           PortType portType = def.createPortType();
  @@ -554,25 +560,14 @@
           // PortType name is the name of the class being processed
           portType.setQName(new javax.wsdl.QName(intfNS, getPortTypeName
           ()));

  -        // Get a ClassRep representing the portType class,
  -        // and get the list of MethodRep
  -        // objects representing the methods that should
  -        // be contained in the portType.
  -        // This allows users to provide their own method/parameter
  mapping.
  -        BuilderPortTypeClassRep builder =
  -           factory.getBuilderPortTypeClassRep();
  -        ClassRep classRep =
  -           builder.build(cls, useInheritedMethods, stopClasses,
  implCls);
  -        Vector methods =
  -           builder.getResolvedMethods(classRep,
  -                                      allowedMethods,
  -                                      disallowedMethods);
  -
  -        for(int i=0; i<methods.size(); i++) {
  -            MethodRep method = (MethodRep) methods.elementAt(i);
  -            BindingOperation bindingOper = writeOperation(def, binding,
  method);
  +        ArrayList operations = serviceDesc.getOperations();
  +        for (Iterator i = operations.iterator(); i.hasNext();) {
  +            OperationDesc thisOper = (OperationDesc)i.next();
  +            BindingOperation bindingOper = writeOperation(def,
  +                                                          binding,
  +                                                          thisOper);
               Operation oper = bindingOper.getOperation();
  -            writeMessages(def, oper, method, bindingOper);
  +            writeMessages(def, oper, thisOper, bindingOper);
               portType.addOperation(oper);
           }

  @@ -581,53 +576,55 @@
           binding.setPortType(portType);
       }

  -    /** Create a Message
  +    /** Create a Message
        *
  -     * @param def
  -     * @param oper
  -     * @param method (A MethodRep object)
  +     * @param def
  +     * @param oper
        * @throws Exception
        */
       private void writeMessages(Definition def, Operation oper,
  -            MethodRep method, BindingOperation bindingOper)
  +            OperationDesc desc, BindingOperation bindingOper)
               throws Exception{
           Input input = def.createInput();

  -        Message msg = writeRequestMessage(def, method);
  +        Message msg = writeRequestMessage(def, desc);
           input.setMessage(msg);

  +
           // Iff this method is overloaded, then give the input
           // stanzas a name.
  -        if (method.isOverloaded()) {
  -            String name = msg.getQName().getLocalPart();
  -            input.setName(name);
  -            bindingOper.getBindingInput().setName(name);
  -        }
  +//        if (method.isOverloaded()) {
  +//            String name = msg.getQName().getLocalPart();
  +//            input.setName(name);
  +//            bindingOper.getBindingInput().setName(name);
  +//        }
           oper.setInput(input);

           def.addMessage(msg);

  -        msg = writeResponseMessage(def, method);
  +        msg = writeResponseMessage(def, desc);
           Output output = def.createOutput();
           output.setMessage(msg);

           // Iff this method is overloaded, then give the output
           // stanzas a name.
  -        if (method.isOverloaded()) {
  -            String name = msg.getQName().getLocalPart();
  -            output.setName(name);
  -            bindingOper.getBindingOutput().setName(name);
  -        }
  +//        if (method.isOverloaded()) {
  +//            String name = msg.getQName().getLocalPart();
  +//            output.setName(name);
  +//            bindingOper.getBindingOutput().setName(name);
  +//        }
           oper.setOutput(output);

           def.addMessage(msg);

  -        Vector exceptions = method.getExceptions();
  -        for (int i = 0; i < exceptions.size(); i++) {
  -            msg = writeFaultMessage(def, (ExceptionRep)
  exceptions.elementAt(i));
  +        ArrayList exceptions = desc.getFaults();
  +
  +        for (int i = 0; exceptions != null && i < exceptions.size();
  i++) {
  +            FaultDesc faultDesc = (FaultDesc) exceptions.get(i);
  +            msg = writeFaultMessage(def, faultDesc);
               Fault fault = def.createFault();
               fault.setMessage(msg);
  -            fault.setName(((ExceptionRep)
  exceptions.elementAt(i)).getName());
  +            fault.setName((faultDesc).getName());
               oper.addFault(fault);
               if (def.getMessage(msg.getQName()) == null) {
                   def.addMessage(msg);
  @@ -635,15 +632,11 @@
           }

           // Set the parameter ordering using the parameter names
  +        ArrayList parameters = desc.getParameters();
           Vector names = new Vector();
  -        for (int i=0; i<method.getParameters().size(); i++) {
  -            ParamRep parameter = (ParamRep)
  -                method.getParameters().elementAt(i);
  -            if ((i == 0) &&
  -                MessageContext.class.equals(parameter.getType())) {
  -                continue;
  -            }
  -            names.add(parameter.getName());
  +        for (int i = 0; i < parameters.size(); i++) {
  +            ParameterDesc param = (ParameterDesc)parameters.get(i);
  +            names.add(param.getName());
           }

           if (names.size() > 0)
  @@ -652,32 +645,28 @@

       /** Create a Operation
        *
  -     * @param def
  -     * @param binding
  -     * @param methodRep  - Representation of the method
  -     * @throws Exception
  +     * @param def
  +     * @param binding
        */
  -    private BindingOperation writeOperation(Definition def,
  -                                     Binding binding,
  -                                     MethodRep methodRep) {
  +    private BindingOperation writeOperation(Definition def,
  +                                     Binding binding,
  +                                     OperationDesc desc) {
           Operation oper = def.createOperation();
  -        oper.setName(methodRep.getName());
  +        oper.setName(desc.getName());
           oper.setUndefined(false);
  -        return writeBindingOperation(def, binding, oper, methodRep);
  +        return writeBindingOperation(def, binding, oper, desc);
       }

       /** Create a Binding Operation
        *
  -     * @param def
  -     * @param binding
  -     * @param oper
  -     * @param methodRep  - Representation of the method
  -     * @throws Exception
  +     * @param def
  +     * @param binding
  +     * @param oper
        */
  -    private BindingOperation writeBindingOperation (Definition def,
  -                                        Binding binding,
  +    private BindingOperation writeBindingOperation (Definition def,
  +                                        Binding binding,
                                           Operation oper,
  -                                        MethodRep methodRep) {
  +                                        OperationDesc desc) {
           BindingOperation bindingOper = def.createBindingOperation();
           BindingInput bindingInput = def.createBindingInput();
           BindingOutput bindingOutput = def.createBindingOutput();
  @@ -686,16 +675,16 @@
           bindingOper.setOperation(oper);

           SOAPOperation soapOper = new SOAPOperationImpl();
  -        String soapAction = methodRep.getMetaData("soapAction");
  +        String soapAction = desc.getSoapAction();
           if (soapAction == null) {
               soapAction = "";
           }
           soapOper.setSoapActionURI(soapAction);
  -
  +
           // Until we have per-operation configuration, this will always
           be
           // the same as the binding default.
           // soapOper.setStyle("rpc");
  -
  +
           bindingOper.addExtensibilityElement(soapOper);

           // Input SOAP Body
  @@ -711,13 +700,13 @@
               soapBodyIn.setNamespaceURI(intfNS);
           else
               soapBodyIn.setNamespaceURI(targetService);
  -        String namespace = methodRep.getMetaData("inputNamespace");
  -        if (namespace != null) {
  -            soapBodyIn.setNamespaceURI(namespace);
  +        QName operQName = desc.getElementQName();
  +        if (operQName != null) {
  +            soapBodyIn.setNamespaceURI(operQName.getLocalPart());
           }
           soapBodyIn.setEncodingStyles(encodingList);
           bindingInput.addExtensibilityElement(soapBodyIn);
  -
  +
           // Output SOAP Body
           SOAPBody soapBodyOut = new SOAPBodyImpl();
           // for now, if its document, it literal use.
  @@ -731,9 +720,9 @@
               soapBodyOut.setNamespaceURI(intfNS);
           else
               soapBodyOut.setNamespaceURI(targetService);
  -        namespace = methodRep.getMetaData("outputNamespace");
  -        if (namespace != null) {
  -            soapBodyOut.setNamespaceURI(namespace);
  +        QName retQName = desc.getReturnQName();
  +        if (retQName != null) {
  +            soapBodyOut.setNamespaceURI(retQName.getLocalPart());
           }
           bindingOutput.addExtensibilityElement(soapBodyOut);

  @@ -747,31 +736,24 @@

       /** Create a Request Message
        *
  -     * @param def
  -     * @param method (a MethodRep object)
  +     * @param def
        * @throws Exception
        */
       private Message writeRequestMessage(Definition def,
  -                                        MethodRep method) throws
  Exception
  +                                        OperationDesc oper) throws
  Exception
       {
           Message msg = def.createMessage();

           javax.wsdl.QName qName
  -                = createMessageName(def, method.getName(), "Request");
  +                = createMessageName(def, oper.getName(), "Request");

           msg.setQName(qName);
           msg.setUndefined(false);

  -        Vector parameters = method.getParameters();
  +        ArrayList parameters = oper.getParameters();
           for(int i=0; i<parameters.size(); i++) {
  -            ParamRep parameter = (ParamRep) parameters.elementAt(i);
  -            // If the first param is a MessageContext, Axis will
  -            // generate it for us - it shouldn't be in the WSDL.
  -            if ((i == 0) &&
  -                MessageContext.class.equals(parameter.getType())) {
  -                continue;
  -            }
  -            writePartToMessage(def, msg, true,parameter);
  +            ParameterDesc parameter = (ParameterDesc) parameters.get(i);
  +            writePartToMessage(def, msg, true, parameter);
           }

           return msg;
  @@ -779,47 +761,49 @@

       /** Create a Response Message
        *
  -     * @param def
  -     * @param method
  +     * @param def
        * @throws Exception
        */
  -    private Message writeResponseMessage(Definition def,
  -                                         MethodRep method) throws
  Exception
  +    private Message writeResponseMessage(Definition def,
  +                                         OperationDesc desc) throws
  Exception
       {
           Message msg = def.createMessage();

           javax.wsdl.QName qName
  -                = createMessageName(def, method.getName(), "Response");
  +                = createMessageName(def, desc.getName(), "Response");

           msg.setQName(qName);
           msg.setUndefined(false);

           // Write the part
  -        ParamRep retParam = method.getReturns();
  +        ParameterDesc retParam = new ParameterDesc();
  +        if (desc.getReturnQName() == null) {
  +            retParam.setName("return");
  +        } else {
  +            retParam.setQName(desc.getReturnQName());
  +        }
  +        retParam.setTypeQName(desc.getReturnType());
  +        retParam.setJavaType(desc.getReturnClass());
  +        retParam.setMode(ParameterDesc.OUT);
  +        // FIXME : Set Java type??
           writePartToMessage(def, msg, false, retParam);

  -        Vector parameters = method.getParameters();
  -        for(int i=0; i<parameters.size(); i++) {
  -            ParamRep parameter = (ParamRep) parameters.elementAt(i);
  -            // If the first param is a MessageContext, Axis will
  -            // generate it for us - it shouldn't be in the WSDL.
  -            if ((i == 0) &&
  -                MessageContext.class.equals(parameter.getType())) {
  -                continue;
  -            }
  -            writePartToMessage(def, msg, false,parameter);
  +        ArrayList parameters = desc.getParameters();
  +        for (Iterator i = parameters.iterator(); i.hasNext();) {
  +            ParameterDesc param = (ParameterDesc)i.next();
  +            writePartToMessage(def, msg, false, param);
           }
           return msg;
       }

       /** Create a Fault Message
        *
  -     * @param def
  -     * @param exception (an ExceptionRep object)
  +     * @param def
  +     * @param exception (an ExceptionRep object)
        * @throws Exception
        */
       private Message writeFaultMessage(Definition def,
  -                                      ExceptionRep exception) throws
  Exception
  +                                      FaultDesc exception) throws
  Exception
       {

           String pkgAndClsName = exception.getName();
  @@ -827,11 +811,11 @@
                                                    pkgAndClsName.length
                                                    ());

           // There are inconsistencies in the JSR 101 version 0.7
  specification
  -        // with regards to whether the java exception class name is
  mapped to
  -        // the wsdl:fault name= attribute or is mapped to the
  wsdl:message of
  +        // with regards to whether the java exception class name is
  mapped to
  +        // the wsdl:fault name= attribute or is mapped to the
  wsdl:message of
           // the wsdl:fault message= attribute.  Currently WSDL2Java uses
           the
           // latter mapping to generate the java exception class.
  -        //
  +        //
           // The following code uses the class name for both the name=
           attribute
           // and the message= attribute.

  @@ -846,16 +830,10 @@
               msg.setQName(qName);
               msg.setUndefined(false);

  -            Vector parameters = exception.getParameters();
  +            ArrayList parameters = exception.getParameters();
               for (int i=0; i<parameters.size(); i++) {
  -                ParamRep parameter = (ParamRep) parameters.elementAt(i);
  -                // If the first param is a MessageContext, Axis will
  -                // generate it for us - it shouldn't be in the WSDL.
  -                if ((i == 0) &&
  -                    MessageContext.class.equals(parameter.getType())) {
  -                    continue;
  -                }
  -                writePartToMessage(def, msg, true, parameter);
  +                ParameterDesc parameter = (ParameterDesc)
  parameters.get(i);
  +                writePartToMessage(def, msg, true, parameter);
               }

               exceptionMsg.put(pkgAndClsName, msg);
  @@ -867,37 +845,37 @@

       /** Create a Part
        *
  -     * @param def
  -     * @param msg
  +     * @param def
  +     * @param msg
        * @param request     message is for a request
  -     * @param param       ParamRep object
  +     * @param param       ParamRep object
        * @return The parameter name added or null
        * @throws Exception
        */
  -    public String writePartToMessage(Definition def,
  +    public String writePartToMessage(Definition def,
                                        Message msg,
                                        boolean request,
  -                                     ParamRep param) throws Exception
  +                                     ParameterDesc param) throws
  Exception
       {
           // Return if this is a void type
           if (param == null ||
  -            param.getType() == java.lang.Void.TYPE)
  +            param.getJavaType() == java.lang.Void.TYPE)
               return null;

           // If Request message, only continue if IN or INOUT
           // If Response message, only continue if OUT or INOUT
  -        if (request &&
  -            param.getMode() == ParamRep.OUT)
  +        if (request &&
  +            param.getMode() == ParameterDesc.OUT)
               return null;
  -        if (!request &&
  -            param.getMode() == ParamRep.IN)
  +        if (!request &&
  +            param.getMode() == ParameterDesc.IN)
               return null;

           // Create the Part
           Part part = def.createPart();

           // Write the type representing the parameter type
  -        javax.wsdl.QName typeQName = types.writePartType(param.getType
  ());
  +        javax.wsdl.QName typeQName =
  types.writePartType(param.getJavaType());
           if (typeQName != null) {
               part.setTypeName(typeQName);
               part.setName(param.getName());
  @@ -919,7 +897,7 @@
           // Check the make sure there isn't a message with this name
           already
           int messageNumber = 1;
           while (def.getMessage(qName) != null) {
  -            StringBuffer namebuf =
  +            StringBuffer namebuf =
                   new StringBuffer(methodName.concat(suffix));
               namebuf.append(messageNumber);
               qName = new javax.wsdl.QName(intfNS, namebuf.toString());
  @@ -935,15 +913,15 @@
        * @param filename the name of the file to be written
        * @throws Exception various file i/o exceptions
        */
  -    private void prettyDocumentToFile(Document doc, String filename)
  +    private void prettyDocumentToFile(Document doc, String filename)
           throws Exception {
  -        FileOutputStream fos = new FileOutputStream(new File(filename));
  +        FileOutputStream fos = new FileOutputStream(new File(filename));
           XMLUtils.PrettyDocumentToStream(doc, fos);
           fos.close();
        }

       // -------------------- Parameter Query Methods
  ----------------------------//
  -
  +
       /**
        * Returns the <code>Class</code> to export
        * @return the <code>Class</code> to export
  @@ -963,7 +941,6 @@
       /**
        * Sets the <code>Class</code> to export.
        * @param cls the <code>Class</code> to export
  -     * @param name service location
        */
       public void setClsSmart(Class cls, String location) {

  @@ -972,20 +949,20 @@

           // Strip off \ and / from location
           if (location.lastIndexOf('/') > 0) {
  -            location =
  +            location =
                 location.substring(location.lastIndexOf('/') + 1);
           } else if (location.lastIndexOf('\\') > 0) {
  -            location =
  +            location =
                 location.substring(location.lastIndexOf('\\') + 1);
  -        }
  +        }

           // Get the constructors of the class
  -        java.lang.reflect.Constructor[] constructors =
  +        java.lang.reflect.Constructor[] constructors =
             cls.getDeclaredConstructors();
           Class intf = null;
           for (int i=0; i<constructors.length && intf == null; i++) {
               Class[] parms = constructors[i].getParameterTypes();
  -            // If the constructor has a single parameter
  +            // If the constructor has a single parameter
               // that is an interface which
               // matches the location, then use this as the interface
               class.
               if (parms.length == 1 &&
  @@ -1050,12 +1027,12 @@

       /**
        * Sets the <code>Java2WSDLFactory Class</code> to use
  -     * @param className the name of the factory <code>Class</code>
  +     * @param className the name of the factory <code>Class</code>
        */
       public void setFactory(String className) {
           try {
               ClassLoader cl = Thread.currentThread
               ().getContextClassLoader();
  -            factory = (Java2WSDLFactory)
  +            factory = (Java2WSDLFactory)
                   Class.forName(className, true,cl).newInstance();
           }
           catch (Exception ex) {
  @@ -1065,7 +1042,7 @@

       /**
        * Sets the <code>Java2WSDLFactory Class</code> to use
  -     * @param factory is the factory Class
  +     * @param factory is the factory Class
        */
       public void setFactory(Java2WSDLFactory factory) {
           this.factory = factory;
  @@ -1084,15 +1061,15 @@
        * @return interface target namespace
        */
       public String getIntfNamespace() {
  -        return intfNS;
  +        return intfNS;
       }

       /**
        * Set the interface namespace
  -     * @param ns interface target namespace
  +     * @param ns interface target namespace
        */
       public void setIntfNamespace(String ns) {
  -        this.intfNS = ns;
  +        this.intfNS = ns;
       }

      /**
  @@ -1100,15 +1077,15 @@
        * @return implementation target namespace
        */
       public String getImplNamespace() {
  -        return implNS;
  +        return implNS;
       }

       /**
        * Set the implementation namespace
  -     * @param ns implementation target namespace
  +     * @param ns implementation target namespace
        */
       public void setImplNamespace(String ns) {
  -        this.implNS = ns;
  +        this.implNS = ns;
       }

       /**
  @@ -1121,7 +1098,6 @@

       /**
        * Set a list of methods to export
  -     * @param allowedMethods a space separated list of methods to export
        */
       public void setAllowedMethods(String text) {
           if (text != null) {
  @@ -1132,7 +1108,7 @@
               }
           }
       }
  -
  +
       /**
        * Set a Vector of methods to export
        * @param allowedMethods a vector of methods to export
  @@ -1143,30 +1119,30 @@

       /**
        * Indicates if the emitter will search classes for inherited
        methods
  -     */
  +     */
       public boolean getUseInheritedMethods() {
           return useInheritedMethods;
  -    }
  +    }

       /**
        * Turn on or off inherited method WSDL generation.
  -     */
  +     */
       public void setUseInheritedMethods(boolean useInheritedMethods) {
           this.useInheritedMethods = useInheritedMethods;
  -    }
  +    }

       /**
        * Set a list of methods NOT to export
  -     * @param a vector of method name strings
  -     */
  +     * @param disallowedMethods vector of method name strings
  +     */
       public void setDisallowedMethods(Vector disallowedMethods) {
           this.disallowedMethods = disallowedMethods;
       }

       /**
        * Set a list of methods NOT to export
  -     * @param a space separated list of method names
  -     */
  +     * @param text space separated list of method names
  +     */
       public void setDisallowedMethods(String text) {
           if (text != null) {
               StringTokenizer tokenizer = new StringTokenizer(text, " ,
  +");
  @@ -1179,7 +1155,7 @@

       /**
        * Return list of methods that should not be exported
  -     */
  +     */
       public Vector getDisallowedMethods() {
           return disallowedMethods;
       }
  @@ -1187,33 +1163,33 @@
       /**
        * Set a list of classes (fully qualified) that will stop the
        traversal
        * of the inheritance tree if encounter in method or complex type
        generation
  -     *
  -     * @param a vector of class name strings
  -     */
  -    public void setStopClasses(Vector stopClasses) {
  +     *
  +     * @param stopClasses vector of class name strings
  +     */
  +    public void setStopClasses(ArrayList stopClasses) {
           this.stopClasses = stopClasses;
       }

       /**
        * Set a list of classes (fully qualified) that will stop the
        traversal
        * of the inheritance tree if encounter in method or complex type
        generation
  -     *
  -     * @param a space separated list of class names
  -     */
  +     *
  +     * @param text space separated list of class names
  +     */
       public void setStopClasses(String text) {
           if (text != null) {
               StringTokenizer tokenizer = new StringTokenizer(text, " ,
  +");
  -            stopClasses = new Vector();
  +            stopClasses = new ArrayList();
               while (tokenizer.hasMoreTokens()) {
                   stopClasses.add(tokenizer.nextToken());
               }
           }
       }
  -
  +
       /**
        * Return the list of classes which stop inhertance searches
  -     */
  -    public Vector getStopClasses() {
  +     */
  +    public ArrayList getStopClasses() {
           return stopClasses;
       }

  @@ -1259,9 +1235,9 @@
       }

       /**
  -     * Set the String representation of the interface location URL
  +     * Set the String representation of the interface location URL
        * for importing
  -     * @param locationUrl the String representation of the interface
  +     * @param importUrl the String representation of the interface
        * location URL for importing
        */
       public void setImportUrl(String importUrl) {
  @@ -1278,7 +1254,7 @@

       /**
        * Set the String representation of the service port name
  -     * @param serviceUrn the String representation of the service port
  name
  +     * @param servicePortName the String representation of the service
  port name
        */
       public void setServicePortName(String servicePortName) {
           this.servicePortName = servicePortName;
  @@ -1294,14 +1270,14 @@

       /**
        * Set the String representation of the service element name
  -     * @param serviceUrn the String representation of the service
  element name
  +     * @param serviceElementName the String representation of the
  service element name
        */
       public void setServiceElementName(String serviceElementName) {
           this.serviceElementName = serviceElementName;
       }

       /**
  -     * Returns the String representation of the portType name
  +     * Returns the String representation of the portType name
        * @return String representation of the portType name
        */
       public String getPortTypeName() {
  @@ -1309,8 +1285,8 @@
       }

       /**
  -     * Set the String representation of the portType name
  -     * @param serviceUrn the String representation of the portType name
  +     * Set the String representation of the portType name
  +     * @param portTypeName the String representation of the portType
  name
        */
       public void setPortTypeName(String portTypeName) {
           this.portTypeName = portTypeName;
  @@ -1386,5 +1362,13 @@

       public void setMode(int mode) {
           this.mode = mode;
  +    }
  +
  +    public ServiceDesc getServiceDesc() {
  +        return serviceDesc;
  +    }
  +
  +    public void setServiceDesc(ServiceDesc serviceDesc) {
  +        this.serviceDesc = serviceDesc;
       }
   }



  1.3       +2 -2
  xml-axis/java/src/org/apache/axis/wsdl/fromJava/ExceptionRep.java

  Index: ExceptionRep.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/ExceptionRep.java,v

  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExceptionRep.java 27 Feb 2002 20:31:10 -0000    1.2
  +++ ExceptionRep.java 1 Apr 2002 20:12:17 -0000     1.3
  @@ -77,8 +77,8 @@
       /**
        * Constructor
        * Create a default representation of ExceptionRep
  -     * @param Class name of the exception
  -     * @param Parameters used in exception class
  +     * @param name name of the exception
  +     * @param parameters parameters used in exception class
        */
       public ExceptionRep(String name, Vector parameters) {
           _name = name;



  1.19      +7 -8
  xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java

  Index: Types.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Types.java  28 Feb 2002 18:50:13 -0000    1.18
  +++ Types.java  1 Apr 2002 20:12:17 -0000     1.19
  @@ -83,6 +83,7 @@
   import java.util.Iterator;
   import java.util.Map;
   import java.util.Vector;
  +import java.util.List;

   import javax.wsdl.Definition;
   import javax.wsdl.factory.WSDLFactory;
  @@ -112,13 +113,12 @@
       HashMap schemaElementNames = null;
       HashMap schemaUniqueElementNames = null;
       BuilderBeanClassRep beanBuilder = null;
  -    Vector stopClasses = null;
  +    List stopClasses = null;

       /**
        * This class serailizes a <code>Class</code> to XML Schema. The
        constructor
        * provides the context for the streamed node within the WSDL
        document
        * @param def WSDL Definition Element to declare namespaces
  -     * @param doc Document element of the WSDL used to create child
        elements
        * @param tm TypeMappingRegistry to handle known types
        * @param defaultTM default TM
        * @param namespaces user defined or autogenerated namespace and
        prefix maps
  @@ -131,7 +131,7 @@
                    Namespaces namespaces,
                    String targetNamespace,
                    Java2WSDLFactory factory,
  -                 Vector stopClasses) {
  +                 List stopClasses) {
           this.def = def;
           createDocumentFragment();
           this.tm = tm;
  @@ -153,7 +153,7 @@
        * In case of a primitive type, no need to stream out anything, just
        return
        * the QName of the primitive type
        *
  -     * @param param <code>Class</code> to generate the XML Schema info
  for
  +     * @param type <code>Class</code> to generate the XML Schema info
  for
        * @return the QName of the generated Schema type, null if void
        */
       public QName writePartType(Class type) throws Exception {
  @@ -453,8 +453,8 @@
       /**
        * Write Enumeration Complex Type
        * (Only supports enumeration classes of string types)
  -     * @param qname QName of type.
  -     * @param type class of type
  +     * @param qName QName of type.
  +     * @param cls class of type
        */
       private void writeEnumType(QName qName, Class cls)  throws Exception
       {
           if (!isEnumClass(cls))
  @@ -686,7 +686,6 @@
        * generated in a previous iteration
        *
        * @param qName the name space of the element
  -     * @param typeName the name of the type
        * @return if the type is added returns true, else if the type is
        already present returns false
        */
       private boolean addToElementsList (QName qName) {
  @@ -751,7 +750,7 @@
       /**
        * Return the list of classes that we should not emit WSDL for.
        */
  -    public Vector getStopClasses() {
  +    public List getStopClasses() {
           return stopClasses;
       }




  1.20      +104 -128
  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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- JavaSkelWriter.java     27 Mar 2002 16:46:56 -0000    1.19
  +++ JavaSkelWriter.java     1 Apr 2002 20:12:17 -0000     1.20
  @@ -123,59 +123,17 @@

           // Declare private impl and skeleton base delegates
           pw.println("    private " + implType + ";");
  -        pw.println("    private static org.apache.axis.wsdl.SkeletonImpl
  skel = null;");
  +        pw.println("    private static java.util.Hashtable _myOperations
  = new java.util.Hashtable();");
           pw.println();
  -
  -        // Skeleton constructors
  -        pw.println("    public " + className + "() {");
  -        pw.println("        this.impl = new " + bEntry.getName() + "Impl
  ();");
  -        pw.println("        init();");
  +        pw.println("    public static
  org.apache.axis.description.OperationDesc getOperationDescByName(String
  methodName) {");
  +        pw.println("        return
  (org.apache.axis.description.OperationDesc)
  _myOperations.get(methodName);");
           pw.println("    }");
           pw.println();
  -        pw.println("    public " + className + "(" + implType + ") {");
  -        pw.println("        this.impl = impl;");
  -        pw.println("        init();");
  -        pw.println("    }");

  -        // Initialize operation parameter names & modes
  -        pw.println("    public javax.xml.rpc.namespace.QName
  getParameterName(String opName, int i) {");
  -        pw.println("        return skel.getParameterName(opName, i);");
  -        pw.println("    }");
  -        pw.println();
  -        pw.println("    public static javax.xml.rpc.namespace.QName
  getParameterNameStatic(String opName, int i) {");
  -        pw.println("        init();");
  -        pw.println("        return skel.getParameterName(opName, i);");
  -        pw.println("    }");
  -        pw.println();
  -        pw.println("    public javax.xml.rpc.ParameterMode
  getParameterMode(String opName, int i) {");
  -        pw.println("        return skel.getParameterMode(opName, i);");
  -        pw.println("    }");
  -        pw.println();
  -        pw.println("    public static javax.xml.rpc.ParameterMode
  getParameterModeStatic(String opName, int i) {");
  -        pw.println("        init();");
  -        pw.println("        return skel.getParameterMode(opName, i);");
  -        pw.println("    }");
  -        pw.println();
  -        pw.println("    public static String
  getInputNamespaceStatic(String opName) {");
  -        pw.println("        init();");
  -        pw.println("        return skel.getInputNamespace(opName);");
  -        pw.println("    }");
  -        pw.println();
  -        pw.println("    public static String
  getOutputNamespaceStatic(String opName) {");
  -        pw.println("        init();");
  -        pw.println("        return skel.getOutputNamespace(opName);");
  -        pw.println("    }");
  -        pw.println();
  -        pw.println("    public static String getSOAPAction(String
  opName) {");
  -        pw.println("        init();");
  -        pw.println("        return skel.getSOAPAction(opName);");
  -        pw.println("    }");
  -        pw.println();
           // Initialize operation parameter names
  -        pw.println("    protected static void init() {");
  -        pw.println("        if (skel != null) ");
  -        pw.println("            return;");
  -        pw.println("        skel = new org.apache.axis.wsdl.SkeletonImpl
  ();");
  +        pw.println("    static {");
  +        pw.println("        org.apache.axis.description.OperationDesc
  _oper;");
  +        pw.println("        org.apache.axis.description.ParameterDesc []
  _params;");
           List operations = binding.getBindingOperations();
           for (int i = 0; i < operations.size(); ++i) {
               BindingOperation operation = (BindingOperation)
  operations.get(i);
  @@ -185,89 +143,99 @@
               if (parameters != null) {
                   // The invoked java name of the operation is stored.
                   String opName =
                   Utils.xmlNameToJava(operation.getOperation().getName());
  -                pw.println("        skel.add(\"" + opName + "\",");
  -                pw.println("                 new
  javax.xml.rpc.namespace.QName[] {");
  -                if (parameters.returnType != null) {
  -                    pw.println("                   " +
  -                               Utils.getNewQName(parameters.returnName)
  + ",");
  -                } else {
  -                    pw.println("                   null,");
  -                }
  +                pw.println("        _params = new
  org.apache.axis.description.ParameterDesc [] {");
  +
                   for (int j=0; j < parameters.list.size(); j++) {
                       Parameter p = (Parameter) parameters.list.get(j);
  -                    pw.println("                   " +
  +                    String modeStr;
  +                    switch (p.getMode()) {
  +                        case Parameter.IN:
  +                            modeStr
  = "org.apache.axis.description.ParameterDesc.IN";
  +                            break;
  +                        case Parameter.OUT:
  +                            modeStr
  = "org.apache.axis.description.ParameterDesc.OUT";
  +                            break;
  +                        case Parameter.INOUT:
  +                            modeStr
  = "org.apache.axis.description.ParameterDesc.INOUT";
  +                            break;
  +                        default:
  +                            throw new IOException();
  +                    }
  +                    pw.println("            new
  org.apache.axis.description.ParameterDesc(" +
                          Utils.getNewQName(Utils.getAxisQName(p.getQName
  ())) +
  -                       ",");
  +                       ", " + modeStr + ", null),");
                   }
  -                pw.println("                 },");
  -                pw.println("                 new
  javax.xml.rpc.ParameterMode[] {");
  +
  +                pw.println("        };");
  +//                if (parameters.returnType != null) {
  +//                    pw.println("                   " +
  +//
  Utils.getNewQName(parameters.returnName) + ",");
  +//                } else {
  +//                    pw.println("                   null,");
  +//                }
  +
  +//                // Find the input clause's namespace
  +//                BindingInput input = operation.getBindingInput();
  +//                if (input == null) {
  +//                    pw.println("                 null,");
  +//                }
  +//                else {
  +//                    List elems = input.getExtensibilityElements();
  +//                    boolean found = false;
  +//                    Iterator it = elems.iterator();
  +//                    while (!found && it.hasNext()) {
  +//                        ExtensibilityElement elem
  = (ExtensibilityElement) it.next();
  +//                        if (elem instanceof SOAPBody) {
  +//                            SOAPBody body = (SOAPBody) elem;
  +//                            String ns = body.getNamespaceURI();
  +//                            if (ns != null) {
  +//                                pw.println("                 \"" + ns
  + "\",");
  +//                                found = true;
  +//                            }
  +//                        }
  +//                    }
  +//                    if (!found) {
  +//                        pw.println("                 null,");
  +//                    }
  +//                }
  +//
  +//                // Find the output clause's namespace
  +//                BindingOutput output = operation.getBindingOutput();
  +//                if (output == null) {
  +//                    pw.println("                 null,");
  +//                }
  +//                else {
  +//                    List elems = output.getExtensibilityElements();
  +//                    Iterator it = elems.iterator();
  +//                    boolean found = false;
  +//                    while (!found && it.hasNext()) {
  +//                        ExtensibilityElement elem
  = (ExtensibilityElement) it.next();
  +//                        if (elem instanceof SOAPBody) {
  +//                            SOAPBody body = (SOAPBody) elem;
  +//                            String ns = body.getNamespaceURI();
  +//                            if (ns != null) {
  +//                                pw.println("                 \"" + ns
  + "\",");
  +//                                found = true;
  +//                            }
  +//                        }
  +//                    }
  +//                    if (!found) {
  +//                        pw.println("                 null,");
  +//                    }
  +//                }
  +//
  +//                if (!found) {
  +//                    pw.println("                 null);");
  +//                }
  +                String returnStr;
                   if (parameters.returnType != null) {
  -                    pw.println("
  javax.xml.rpc.ParameterMode.OUT,");
  +                    returnStr =
  Utils.getNewQName(parameters.returnName);
                   } else {
  -                    pw.println("                   null,");
  +                    returnStr = "null";
                   }
  -                for (int j=0; j < parameters.list.size(); j++) {
  -                    Parameter p = (Parameter) parameters.list.get(j);
  -                    if (p.getMode() == Parameter.IN)
  -                        pw.println("
  javax.xml.rpc.ParameterMode.IN,");
  -                    else if (p.getMode() == Parameter.OUT)
  -                        pw.println("
  javax.xml.rpc.ParameterMode.INOUT,");
  -                    else
  -                        pw.println("
  javax.xml.rpc.ParameterMode.OUT,");
  +                pw.println("        _oper = new
  org.apache.axis.description.OperationDesc(\"" +
  +                            opName + "\", _params, " + returnStr +
  ");");

  -                }
  -                pw.println("                 },");
  -
  -                // Find the input clause's namespace
  -                BindingInput input = operation.getBindingInput();
  -                if (input == null) {
  -                    pw.println("                 null,");
  -                }
  -                else {
  -                    List elems = input.getExtensibilityElements();
  -                    boolean found = false;
  -                    Iterator it = elems.iterator();
  -                    while (!found && it.hasNext()) {
  -                        ExtensibilityElement elem
  = (ExtensibilityElement) it.next();
  -                        if (elem instanceof SOAPBody) {
  -                            SOAPBody body = (SOAPBody) elem;
  -                            String ns = body.getNamespaceURI();
  -                            if (ns != null) {
  -                                pw.println("                 \"" + ns +
  "\",");
  -                                found = true;
  -                            }
  -                        }
  -                    }
  -                    if (!found) {
  -                        pw.println("                 null,");
  -                    }
  -                }
  -
  -                // Find the output clause's namespace
  -                BindingOutput output = operation.getBindingOutput();
  -                if (output == null) {
  -                    pw.println("                 null,");
  -                }
  -                else {
  -                    List elems = output.getExtensibilityElements();
  -                    Iterator it = elems.iterator();
  -                    boolean found = false;
  -                    while (!found && it.hasNext()) {
  -                        ExtensibilityElement elem
  = (ExtensibilityElement) it.next();
  -                        if (elem instanceof SOAPBody) {
  -                            SOAPBody body = (SOAPBody) elem;
  -                            String ns = body.getNamespaceURI();
  -                            if (ns != null) {
  -                                pw.println("                 \"" + ns +
  "\",");
  -                                found = true;
  -                            }
  -                        }
  -                    }
  -                    if (!found) {
  -                        pw.println("                 null,");
  -                    }
  -                }
  -
                   // Find the SOAPAction.
                   List elems = operation.getExtensibilityElements();
                   Iterator it = elems.iterator();
  @@ -278,18 +246,26 @@
                           SOAPOperation soapOp = (SOAPOperation) elem;
                           String action = soapOp.getSoapActionURI();
                           if (action != null) {
  -                            pw.println("                 \"" + action +
  "\");");
  +                            pw.println("        _oper.setSoapAction(\""
  + action + "\");");
                               found = true;
                           }
                       }
                   }
  -                if (!found) {
  -                    pw.println("                 null);");
  -                }
  -            }
  +
  +                pw.println("        _myOperations.put(\"" + opName + "
  \", _oper);");
  +            }
           }
           pw.println("    }");
           pw.println();
  +
  +        // Skeleton constructors
  +        pw.println("    public " + className + "() {");
  +        pw.println("        this.impl = new " + bEntry.getName() + "Impl
  ();");
  +        pw.println("    }");
  +        pw.println();
  +        pw.println("    public " + className + "(" + implType + ") {");
  +        pw.println("        this.impl = impl;");
  +        pw.println("    }");

           // Now write each of the operation methods
           for (int i = 0; i < operations.size(); ++i) {



  1.7       +15 -3
  xml-axis/java/test/wsdl/multithread/MultithreadTestCase.java

  Index: MultithreadTestCase.java
  ===================================================================
  RCS file:
  /home/cvs/xml-axis/java/test/wsdl/multithread/MultithreadTestCase.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MultithreadTestCase.java      23 Feb 2002 00:48:28 -0000    1.6
  +++ MultithreadTestCase.java      1 Apr 2002 20:12:17 -0000     1.7
  @@ -34,6 +34,12 @@
               LogFactory.getLog(MultithreadTestCase.class.getName());

       private AddressBook binding;
  +    private static int successCount = 0;
  +
  +    static synchronized void addSuccess()
  +    {
  +        successCount++;
  +    }

       public MultithreadTestCase(String name) {
           super(name);
  @@ -86,6 +92,8 @@

                       binding.addEntry("hi", address);
                       Address addressRet = binding.getAddressFromName
                       ("hi");
  +                    // succeeded, count it.
  +                    addSuccess();
                   }
               } catch (Throwable t) {
                   // There are bound to be connection refused exceptions
  when the
  @@ -113,18 +121,22 @@
           }
           assertTrue("binding is null", binding != null);
           ((AddressBookSOAPBindingStub) binding).setMaintainSession(true);
  -        Thread[] threads = new Thread[100];
  -        for (int i = 0; i < 100; ++i) {
  +        int NUM_THREADS = 100;
  +        Thread[] threads = new Thread[NUM_THREADS];
  +        for (int i = 0; i < NUM_THREADS; ++i) {
               threads[i] = new Thread(new Run());
               threads[i].start();
           }
  -        for (int i = 0; i < 100; ++i) {
  +        for (int i = 0; i < NUM_THREADS; ++i) {
               try {
                   threads[i].join();
               }
               catch (InterruptedException ie) {
               }
           }
  +        System.out.println("Had " + successCount +
  +                           " successes (of a possible " +
  +                           (NUM_THREADS * 4) + ")");
           if (error != null) {
               throw error;
           }





Reply via email to