gdaniels    02/02/02 10:06:19

  Modified:    java/samples/encoding DataSer.java
               java/src/org/apache/axis/encoding Serializer.java
               java/src/org/apache/axis/encoding/ser ArraySerializer.java
                        Base64Serializer.java BeanSerializer.java
                        DateSerializer.java ElementSerializer.java
                        HexSerializer.java JAFDataHandlerSerializer.java
                        MapSerializer.java SimpleSerializer.java
               java/src/org/apache/axis/wsdl/fromJava Types.java
               java/test/encoding DataSer.java
  Log:
  First cut at customizable schema generation.
  
  Introduced a writeSchema() method into the Serializer interface, which
  takes an org.apache.axis.wsdl.toJava.Types object.  The serializer may
  optionally use the passed Types object to write an appropriate schema
  fragment into the WSDL being generated, and returns true if this was done,
  false otherwise.
  
  Currently, the two serializers that really use this are the MapSerializer (which
  now produces the correct type description) and the BeanSerializer (which
  calls back to Types.writeBeanClassType() to do the actual work).
  
  This needs some more fleshing out, but the immediate problem with Maps
  generating incorrect schema has been solved.
  
  Revision  Changes    Path
  1.15      +18 -4     xml-axis/java/samples/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/samples/encoding/DataSer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- DataSer.java      26 Jan 2002 02:52:38 -0000      1.14
  +++ DataSer.java      2 Feb 2002 18:06:18 -0000       1.15
  @@ -7,6 +7,7 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
  @@ -18,12 +19,12 @@
       public static final String FLOATMEMBER = "floatMember";
       public static final String DATAMEMBER = "dataMember";
       public static final QName myTypeQName = new QName("typeNS", "Data");
  -    
  +
       /** SERIALIZER STUFF
        */
       /**
  -     * Serialize an element named name, with the indicated attributes 
  -     * and value.  
  +     * Serialize an element named name, with the indicated attributes
  +     * and value.
        * @param name is the element name
        * @param attributes are the attributes...serialize is free to add more.
        * @param value is the value
  @@ -36,7 +37,7 @@
           if (!(value instanceof Data))
               throw new IOException("Can't serialize a " + value.getClass().getName() 
+ " with a DataSerializer.");
           Data data = (Data)value;
  -        
  +
           context.startElement(name, attributes);
           context.serialize(new QName("", STRINGMEMBER), null, data.stringMember, 
String.class);
           context.serialize(new QName("", FLOATMEMBER), null, data.floatMember, 
float.class);
  @@ -44,4 +45,17 @@
           context.endElement();
       }
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.15      +19 -5     xml-axis/java/src/org/apache/axis/encoding/Serializer.java
  
  Index: Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/Serializer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- Serializer.java   26 Jan 2002 02:40:33 -0000      1.14
  +++ Serializer.java   2 Feb 2002 18:06:18 -0000       1.15
  @@ -57,26 +57,29 @@
   package org.apache.axis.encoding;
   
   import org.xml.sax.Attributes;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
  +import org.apache.axis.wsdl.fromJava.Types;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
   
   /**
    * This interface describes the AXIS Serializer.
  - * An Axis compliant Serializer must provide one or more 
  + * An Axis compliant Serializer must provide one or more
    * of the following methods:
    *
    * public <constructor>(Class javaType, QName xmlType)
    * public <constructor>()
    *
  - * This will allow for construction of generic factories that introspect the class 
  + * This will allow for construction of generic factories that introspect the class
    * to determine how to construct a deserializer.
  - * The xmlType, javaType arguments are filled in with the values known by the 
factory. 
  + * The xmlType, javaType arguments are filled in with the values known by the 
factory.
    */
   public interface Serializer extends javax.xml.rpc.encoding.Serializer {
       /**
  -     * Serialize an element named name, with the indicated attributes 
  -     * and value.  
  +     * Serialize an element named name, with the indicated attributes
  +     * and value.
        * @param name is the element name
        * @param attributes are the attributes...serialize is free to add more.
        * @param value is the value
  @@ -85,6 +88,17 @@
       public void serialize(QName name, Attributes attributes,
                             Object value, SerializationContext context)
           throws IOException;
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception;
   }
   
   
  
  
  
  1.6       +40 -24    
xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ArraySerializer.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ArraySerializer.java      1 Feb 2002 04:12:28 -0000       1.5
  +++ ArraySerializer.java      2 Feb 2002 18:06:18 -0000       1.6
  @@ -74,7 +74,10 @@
   import org.apache.axis.encoding.DeserializerImpl;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.utils.JavaUtils;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   import java.lang.reflect.Array;
   import java.util.ArrayList;
  @@ -86,12 +89,12 @@
   import java.beans.IntrospectionException;
   
   /**
  - * An ArraySerializer handles serializing of arrays.               
  + * An ArraySerializer handles serializing of arrays.
    *
    * Some code borrowed from ApacheSOAP - thanks to Matt Duftler!
  - * 
  + *
    * @author Glen Daniels ([EMAIL PROTECTED])
  - * 
  + *
    * Multi-reference stuff:
    * @author Rich Scheuerle ([EMAIL PROTECTED])
    */
  @@ -99,7 +102,7 @@
   
       static Category category =
               Category.getInstance(ArraySerializer.class.getName());
  -    
  +
       /**
        * Serialize an element that is an array.
        * @param name is the element name
  @@ -113,10 +116,10 @@
       {
           if (value == null)
               throw new IOException(JavaUtils.getMessage("cantDoNullArray00"));
  -        
  +
           Class cls = value.getClass();
           List list = null;
  -        
  +
           if (!cls.isArray()) {
               if (!(value instanceof List)) {
                   throw new IOException(
  @@ -124,7 +127,7 @@
               }
               list = (List)value;
           }
  -        
  +
           Class componentType;
           if (list == null) {
               componentType = cls.getComponentType();
  @@ -137,9 +140,9 @@
           }
   
           // Check to see if componentType is also an array.
  -        // If so, set the componentType to the most nested non-array 
  +        // If so, set the componentType to the most nested non-array
           // componentType.  Increase the dims string by "[]"
  -        // each time through the loop.  
  +        // each time through the loop.
           // Note from Rich Scheuerle:
           //    This won't handle Lists of Lists or
           //    arrays of Lists....only arrays of arrays.
  @@ -149,7 +152,7 @@
               dims += "[]";
           }
   
  -       
  +
           QName componentQName = context.getQNameForClass(componentType);
           if (componentQName == null)
               throw new IOException(
  @@ -159,8 +162,8 @@
           int len = (list == null) ? Array.getLength(value) : list.size();
   
           String arrayType = compType + dims + "[" + len + "]";
  -        
  -        
  +
  +
           // Discover whether array can be serialized directly as a two-dimensional
           // array (i.e. arrayType=int[2,3]) versus an array of arrays.
           // Benefits:
  @@ -169,11 +172,11 @@
           //   - Tests the deserialization of multi-dimensional arrays.
           // Drawbacks:
           //   - Is not safe!  It is possible that the arrays are multiply
  -        //     referenced.  Transforming into a 2-dim array will cause the 
  +        //     referenced.  Transforming into a 2-dim array will cause the
           //     multi-referenced information to be lost.  Plus there is no
           //     way to determine whether the arrays are multi-referenced.
           //     Thus the code is currently disabled (see enable2Dim below).
  -        //   
  +        //
           // In the future this code may be enabled for cases that we know
           // are safe.
           // (More complicated processing is necessary for 3-dim arrays, etc.
  @@ -186,7 +189,7 @@
                   boolean okay = true;
                   // Make sure all of the component arrays are the same size
                   for (int i=0; i < len && okay; i++) {
  -                
  +
                       Object elementValue = Array.get(value, i);
                       if (elementValue == null)
                           okay = false;
  @@ -208,10 +211,10 @@
                   }
               }
           }
  -        
  +
           // Are we encoded?
           boolean isEncoded = context.getMessageContext().isEncoded();
  -        
  +
           if (isEncoded) {
               AttributesImpl attrs;
               if (attributes != null) {
  @@ -223,18 +226,18 @@
               } else {
                   attrs = new AttributesImpl();
               }
  -            
  +
               if (attrs.getIndex(Constants.URI_CURRENT_SOAP_ENC,
                                  Constants.ATTR_ARRAY_TYPE) == -1) {
  -                String encprefix = 
  +                String encprefix =
                          context.getPrefixForURI(Constants.URI_CURRENT_SOAP_ENC);
  -                attrs.addAttribute(Constants.URI_CURRENT_SOAP_ENC, 
  +                attrs.addAttribute(Constants.URI_CURRENT_SOAP_ENC,
                                      Constants.ATTR_ARRAY_TYPE,
                                      encprefix + ":arrayType",
                                      "CDATA",
                                      arrayType);
               }
  -            
  +
               // Force type to be SOAP_ARRAY for all array serialization.
               int typeI = attrs.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
                                          "type");
  @@ -246,12 +249,12 @@
                   attributes = attrs;
               }
           }
  -        
  +
           // For non-encoded (literal) use, each item is named with the QName
           // we got in the arguments.  For encoded, we write an element with
           // that QName, and then each item is an <item> inside that.
           QName elementName = name;
  -        
  +
           if (isEncoded) {
               context.startElement(name, attributes);
               elementName = new QName("","item");
  @@ -262,7 +265,7 @@
               for (int index = 0; index < len; index++) {
                   Object aValue = (list == null) ? Array.get(value, index) : 
list.get(index);
                   Class aClass = (aValue == null) ? null : aValue.getClass();
  -                
  +
                   context.serialize(elementName, null, aValue, aClass);
               }
           } else {
  @@ -281,4 +284,17 @@
       }
   
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.3       +19 -3     
xml-axis/java/src/org/apache/axis/encoding/ser/Base64Serializer.java
  
  Index: Base64Serializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/Base64Serializer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Base64Serializer.java     31 Jan 2002 03:26:09 -0000      1.2
  +++ Base64Serializer.java     2 Feb 2002 18:06:18 -0000       1.3
  @@ -62,6 +62,7 @@
   import java.io.IOException;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.encoding.SerializerFactory;
   import org.apache.axis.encoding.SerializationContext;
  @@ -70,7 +71,9 @@
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.encoding.DeserializerImpl;
   import org.apache.axis.encoding.Base64;
  - 
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
  +
   /**
    * Serializer for Base64
    *
  @@ -87,7 +90,7 @@
           this.javaType = javaType;
       }
   
  -    /** 
  +    /**
        * Serialize a base64 quantity.
        */
       public void serialize(QName name, Attributes attributes,
  @@ -105,11 +108,24 @@
                       data[i] = b.byteValue();
               }
           }
  -        
  +
           context.startElement(name, attributes);
           context.writeString(Base64.encode(data, 0, data.length));
           context.endElement();
       }
   
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.2       +29 -7     
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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanSerializer.java       26 Jan 2002 02:40:34 -0000      1.1
  +++ BeanSerializer.java       2 Feb 2002 18:06:18 -0000       1.2
  @@ -70,17 +70,24 @@
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.encoding.DeserializerImpl;
   import org.apache.axis.InternalException;
  +import org.apache.axis.wsdl.fromJava.ClassRep;
  +import org.apache.axis.wsdl.fromJava.FieldRep;
  +import org.apache.axis.wsdl.fromJava.Types;
   
   import java.io.Serializable;
   import java.lang.reflect.Method;
   import java.beans.IntrospectionException;
   import org.apache.log4j.Category;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
  +
   import java.beans.Introspector;
   import java.beans.PropertyDescriptor;
   import java.io.ObjectStreamField;
   import java.io.Serializable;
   
   import java.util.HashMap;
  +import java.util.Vector;
   
   /**
    * General purpose serializer/deserializerFactory for an arbitrary java bean.
  @@ -147,15 +154,15 @@
           try {
               // Serialize each property
               for (int i=0; i<pd.length; i++) {
  -                String propName = pd[i].getName();                
  +                String propName = pd[i].getName();
                   if (propName.equals("class")) continue;
                   propName = format(propName, elementPropertyFormat);
  -                
  +
                   Method readMethod = pd[i].getReadMethod();
                   if (readMethod.getParameterTypes().length == 0) {
                       // Normal case: serialize the value
                       Object propValue = pd[i].getReadMethod().invoke(value,noArgs);
  -                    context.serialize(new QName("", propName), null, 
  +                    context.serialize(new QName("", propName), null,
                                         propValue,
                                         pd[i].getReadMethod().getReturnType());
                   } else {
  @@ -171,7 +178,7 @@
                               j = -1;
                           }
                           if (j >= 0) {
  -                            context.serialize(new QName("", propName), null, 
  +                            context.serialize(new QName("", propName), null,
                                                 propValue,
                                                 
pd[i].getReadMethod().getReturnType());
                           }
  @@ -203,13 +210,13 @@
           return pd;
       }
   
  -    /** 
  +    /**
        * Get the format of the elements for the properties
        */
       public short getElementPropertyFormat() {
           return elementPropertyFormat;
       }
  -    /** 
  +    /**
        * Set the format of the elements for the properties
        */
       public void setElementPropertyFormat(short format) {
  @@ -222,7 +229,7 @@
        * Returns the property name string formatted in the specified manner
        * @param name to format
        * @param fmt (PROPERTY_NAME, FORCE_LOWER, FORCE_UPPER)
  -     * @return formatted name 
  +     * @return formatted name
        */
       static String format(String name, short fmt) {
           if (fmt == PROPERTY_NAME)
  @@ -237,4 +244,19 @@
       }
   
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        types.writeBeanClassType(types.getWsdlQName(xmlType), javaType);
  +        return true;
  +    }
  +
   }
  
  
  
  1.2       +19 -3     
xml-axis/java/src/org/apache/axis/encoding/ser/DateSerializer.java
  
  Index: DateSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/DateSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DateSerializer.java       26 Jan 2002 02:40:34 -0000      1.1
  +++ DateSerializer.java       2 Feb 2002 18:06:18 -0000       1.2
  @@ -62,6 +62,7 @@
   import java.io.IOException;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.encoding.SerializerFactory;
   import org.apache.axis.encoding.SerializationContext;
  @@ -69,6 +70,8 @@
   import org.apache.axis.encoding.DeserializerFactory;
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.encoding.DeserializerImpl;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   import java.text.SimpleDateFormat;
   import java.util.Calendar;
  @@ -85,7 +88,7 @@
    */
   public class DateSerializer implements Serializer {
   
  -    private static SimpleDateFormat zulu = 
  +    private static SimpleDateFormat zulu =
          new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
                            //  0123456789 0 123456789
   
  @@ -95,7 +98,7 @@
           zulu.setTimeZone(TimeZone.getTimeZone("GMT"));
       }
   
  -    /** 
  +    /**
        * Serialize a Date.
        */
       public void serialize(QName name, Attributes attributes,
  @@ -119,6 +122,19 @@
           context.writeString(fdate);
           context.endElement();
       }
  -    
  +
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.2       +16 -1     
xml-axis/java/src/org/apache/axis/encoding/ser/ElementSerializer.java
  
  Index: ElementSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/ElementSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElementSerializer.java    26 Jan 2002 02:40:34 -0000      1.1
  +++ ElementSerializer.java    2 Feb 2002 18:06:18 -0000       1.2
  @@ -58,11 +58,13 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.encoding.SerializerFactory;
   import org.apache.axis.encoding.SerializationContext;
  @@ -81,7 +83,7 @@
   
   public class ElementSerializer implements Serializer {
   
  -    /** 
  +    /**
        * Serialize a DOM Element
        */
       public void serialize(QName name, Attributes attributes,
  @@ -97,4 +99,17 @@
       }
   
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.2       +18 -2     
xml-axis/java/src/org/apache/axis/encoding/ser/HexSerializer.java
  
  Index: HexSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/HexSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HexSerializer.java        26 Jan 2002 02:40:34 -0000      1.1
  +++ HexSerializer.java        2 Feb 2002 18:06:18 -0000       1.2
  @@ -62,6 +62,7 @@
   import java.io.IOException;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.encoding.SerializerFactory;
   import org.apache.axis.encoding.SerializationContext;
  @@ -70,6 +71,8 @@
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.encoding.DeserializerImpl;
   import org.apache.axis.encoding.Hex;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   /**
    * Serializer for hexBinary.
    *
  @@ -79,7 +82,7 @@
    */
   public class HexSerializer implements Serializer {
   
  -    /** 
  +    /**
        * Serialize a Hex quantity.
        */
       public void serialize(QName name, Attributes attributes,
  @@ -92,6 +95,19 @@
           context.writeString(data.toString());
           context.endElement();
       }
  -    
  +
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.2       +20 -4     
xml-axis/java/src/org/apache/axis/encoding/ser/JAFDataHandlerSerializer.java
  
  Index: JAFDataHandlerSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/JAFDataHandlerSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JAFDataHandlerSerializer.java     26 Jan 2002 02:40:34 -0000      1.1
  +++ JAFDataHandlerSerializer.java     2 Feb 2002 18:06:18 -0000       1.2
  @@ -75,6 +75,7 @@
   import org.apache.axis.Part;
   import org.apache.axis.attachments.Attachments;
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.xml.sax.Attributes;
   import org.xml.sax.helpers.AttributesImpl;
   
  @@ -84,10 +85,12 @@
   import java.util.Map;
   
   import org.apache.log4j.Category;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   /**
    * JAFDataHandler Serializer
  - * @author Rick Rineholt 
  + * @author Rick Rineholt
    * Modified by Rich Scheuerle <[EMAIL PROTECTED]>
    */
   public class JAFDataHandlerSerializer implements Serializer {
  @@ -95,7 +98,7 @@
       static Category category =
               Category.getInstance(JAFDataHandlerSerializer.class.getName());
   
  -    /** 
  +    /**
        * Serialize a JAF DataHandler quantity.
        */
       public void serialize(QName name, Attributes attributes,
  @@ -116,9 +119,9 @@
           if((typeIndex = attrs.getIndex(Constants.URI_CURRENT_SCHEMA_XSI,
                                   "type")) != -1){
   
  -            //Found a xsi:type which should not be there for attachments.           
             
  +            //Found a xsi:type which should not be there for attachments.
               attrs.removeAttribute(typeIndex);
  -        }                        
  +        }
   
           attrs.addAttribute("", Constants.ATTR_HREF, "href",
                                  "CDATA", href);
  @@ -128,4 +131,17 @@
       }
   
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.2       +50 -6     
xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializer.java
  
  Index: MapSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MapSerializer.java        26 Jan 2002 02:40:34 -0000      1.1
  +++ MapSerializer.java        2 Feb 2002 18:06:18 -0000       1.2
  @@ -62,6 +62,7 @@
   import java.io.IOException;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.encoding.Serializer;
   import org.apache.axis.encoding.SerializerFactory;
   import org.apache.axis.encoding.SerializationContext;
  @@ -77,12 +78,14 @@
   import java.util.Map;
   
   import org.apache.log4j.Category;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   
   /**
    * A <code>MapSerializer</code> is be used to serialize and
    * deserialize Maps using the <code>SOAP-ENC</code>
    * encoding style.<p>
  - * 
  + *
    * @author Glen Daniels ([EMAIL PROTECTED])
    * Modified by @author Rich Scheuerle ([EMAIL PROTECTED])
    */
  @@ -98,10 +101,10 @@
       private static final QName QNAME_VALUE = new QName("", "value");
   
       /** Serialize a Map
  -     * 
  +     *
        * Walk the collection of keys, serializing each key/value pair
        * inside an <item> element.
  -     * 
  +     *
        * @param name the desired QName for the element
        * @param attributes the desired attributes for the element
        * @param value the Object to serialize
  @@ -115,9 +118,9 @@
           if (!(value instanceof Map))
               throw new IOException(
                   JavaUtils.getMessage("noMap00", "MapSerializer", 
value.getClass().getName()));
  -        
  +
           Map map = (Map)value;
  -        
  +
           context.startElement(name, attributes);
   
           for (Iterator i = map.keySet().iterator(); i.hasNext(); )
  @@ -135,6 +138,47 @@
   
           context.endElement();
       }
  -    
  +
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        Element complexType = types.createElement("complexType");
  +        types.writeSchemaElement(types.getWsdlQName(Constants.SOAP_MAP),
  +                                 complexType);
  +        Element seq = types.createElement("sequence");
  +        complexType.appendChild(seq);
  +
  +        Element element = types.createElement("element");
  +        element.setAttribute("name", "item");
  +        element.setAttribute("minOccurs", "0");
  +        element.setAttribute("maxOccurs", "unbounded");
  +        seq.appendChild(element);
  +
  +        Element subType = types.createElement("complexType");
  +        element.appendChild(subType);
  +
  +        Element all = types.createElement("all");
  +        subType.appendChild(all);
  +
  +        Element key = types.createElement("element");
  +        key.setAttribute("name", "key");
  +        key.setAttribute("type", "xsd:anyType");
  +        all.appendChild(key);
  +
  +        Element value = types.createElement("element");
  +        value.setAttribute("name", "value");
  +        value.setAttribute("type", "xsd:anyType");
  +        all.appendChild(value);
  +
  +        return true;
  +    }
   }
  
  
  
  1.2       +21 -5     
xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java
  
  Index: SimpleSerializer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleSerializer.java     26 Jan 2002 02:40:34 -0000      1.1
  +++ SimpleSerializer.java     2 Feb 2002 18:06:18 -0000       1.2
  @@ -62,6 +62,7 @@
   import java.io.IOException;
   
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   import org.apache.axis.utils.JavaUtils;
   import org.apache.axis.utils.XMLUtils;
   import org.apache.axis.encoding.Serializer;
  @@ -71,6 +72,8 @@
   import org.apache.axis.encoding.DeserializerFactory;
   import org.apache.axis.encoding.DeserializationContext;
   import org.apache.axis.encoding.DeserializerImpl;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.Document;
   /**
    * Serializer for primitives and anything simple whose value is obtained with 
toString()
    *
  @@ -84,10 +87,10 @@
           this.xmlType = xmlType;
           this.javaType = javaType;
       }
  -    /** 
  +    /**
        * Serialize a primitive or simple value.
        * If the object to serialize is a primitive, the Object value below
  -     * is the associated java.lang class.  
  +     * is the associated java.lang class.
        * To determine if the original value is a java.lang class or a primitive, 
consult
        * the javaType class.
        */
  @@ -97,11 +100,11 @@
       {
           if (value != null && value.getClass() == java.lang.Object.class) {
               throw new IOException(JavaUtils.getMessage("cantSerialize02"));
  -        } 
  +        }
           context.startElement(name, attributes);
           if (value != null) {
               // We could have separate serializers/deserializers to take
  -            // care of Float/Double cases, but it makes more sence to 
  +            // care of Float/Double cases, but it makes more sence to
               // put them here with the rest of the java lang primitives.
               if (value instanceof Float ||
                   value instanceof Double) {
  @@ -129,6 +132,19 @@
           }
           context.endElement();
       }
  -    
  +
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  
  1.14      +111 -67   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.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Types.java        1 Feb 2002 22:46:13 -0000       1.13
  +++ Types.java        2 Feb 2002 18:06:19 -0000       1.14
  @@ -58,6 +58,8 @@
   
   import org.apache.axis.Constants;
   import org.apache.axis.encoding.TypeMapping;
  +import org.apache.axis.encoding.Serializer;
  +import org.apache.axis.encoding.SerializerFactory;
   import org.apache.axis.utils.XMLUtils;
   
   import org.w3c.dom.Attr;
  @@ -105,7 +107,7 @@
       Element wsdlTypesElem = null;
       HashMap schemaTypes = null;
       HashMap schemaElementNames = null;
  -    HashMap schemaUniqueElementNames = null; 
  +    HashMap schemaUniqueElementNames = null;
       BuilderBeanClassRep beanBuilder = null;
       Vector stopClasses = null;
   
  @@ -115,17 +117,17 @@
        * @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 defaultTM default TM
        * @param namespaces user defined or autogenerated namespace and prefix maps
        * @param targetNamespace targetNamespace of the document
  -     * @param factory Java2WSDLFactory                          
  +     * @param factory Java2WSDLFactory
        */
  -    public Types(Definition def, 
  +    public Types(Definition def,
                    TypeMapping tm,
  -                 TypeMapping defaultTM,   
  -                 Namespaces namespaces, 
  +                 TypeMapping defaultTM,
  +                 Namespaces namespaces,
                    String targetNamespace,
  -                 Java2WSDLFactory factory, 
  +                 Java2WSDLFactory factory,
                    Vector stopClasses) {
           this.def = def;
           createDocumentFragment();
  @@ -216,9 +218,9 @@
                   javax.xml.rpc.namespace.QName cqName = getTypeQName(componentType);
                   String pre = namespaces.getCreatePrefix(cqName.getNamespaceURI());
                   String localPart = "ArrayOf_" + pre + "_" + cqName.getLocalPart();
  -                qName = new javax.xml.rpc.namespace.QName(targetNamespace, 
  +                qName = new javax.xml.rpc.namespace.QName(targetNamespace,
                                                             localPart);
  -            } 
  +            }
           } else {
               // Get the QName from the type mapping or create our own.
               javax.xml.rpc.namespace.QName dQName = null;
  @@ -260,8 +262,8 @@
       public static String getPackageNameFromFullName(String full) {
           if (full.lastIndexOf('.') < 0)
               return "";
  -        else 
  -            return full.substring(0, full.lastIndexOf('.')); 
  +        else
  +            return full.substring(0, full.lastIndexOf('.'));
       }
   
       /**
  @@ -272,8 +274,8 @@
       public static String getLocalNameFromFullName(String full) {
           if (full.lastIndexOf('.') < 0)
               return full;
  -        else 
  -            return full.substring(full.lastIndexOf('.')+1); 
  +        else
  +            return full.substring(full.lastIndexOf('.')+1);
       }
   
       /**
  @@ -283,7 +285,7 @@
        * @param qName qName to get the namespace of the schema node
        * @param element the Element to append to the Schema node
        */
  -    private void writeSchemaElement(QName qName, Element element) {
  +    public void writeSchemaElement(QName qName, Element element) {
           Element schemaElem = null;
           NodeList nl = wsdlTypesElem.getChildNodes();
           for (int i = 0; i < nl.getLength(); i++ ) {
  @@ -315,22 +317,32 @@
       }
   
       /**
  -     * Write a schema representation for the given <code>Class</code>. Recurse 
through all the
  -     * Public fields as well as fields represented by java bean compliant accesor
  -     * methods.
  +     * Write a schema representation for the given <code>Class</code>. Recurse
  +     * through all the public fields as well as fields represented by java
  +     * bean compliant accessor methods.
  +     *
        * Then return the qualified string representation of the generated type
        *
        * @param type Class for which to generate schema
        * @return a prefixed string for the schema type
        * @throws Exception
        */
  -    private String writeType(Class type) throws Exception {
  +    public String writeType(Class type) throws Exception {
  +        Serializer ser = null;
  +        if (tm != null) {
  +        SerializerFactory factory = (SerializerFactory)tm.getSerializer(type);
  +        if (factory != null) {
  +            ser = (Serializer)factory.getSerializerAs(Constants.AXIS_SAX);
  +        }
  +        }
   
           // Quick return if schema type
           if (isSimpleSchemaType(type))
  -            return Constants.NSPREFIX_SCHEMA_XSD + ":" + 
getTypeQName(type).getLocalPart();
  +            return Constants.NSPREFIX_SCHEMA_XSD + ":" +
  +                    getTypeQName(type).getLocalPart();
           if (isSimpleSoapEncodingType(type))
  -            return Constants.NSPREFIX_SOAP_ENC + ":" + 
getTypeQName(type).getLocalPart();
  +            return Constants.NSPREFIX_SOAP_ENC + ":" +
  +                    getTypeQName(type).getLocalPart();
   
           // Write the namespace
           QName qName = writeTypeNamespace(type);
  @@ -362,23 +374,28 @@
   
               Element restriction = docHolder.createElement("restriction");
               complexContent.appendChild(restriction);
  -            restriction.setAttribute("base", Constants.NSPREFIX_SOAP_ENC + 
":Array");
  +            restriction.setAttribute("base",
  +                                     Constants.NSPREFIX_SOAP_ENC + ":Array");
   
               Element attribute = docHolder.createElement("attribute");
               restriction.appendChild(attribute);
  -            attribute.setAttribute("ref", Constants.NSPREFIX_SOAP_ENC 
+":arrayType");
  +            attribute.setAttribute("ref",
  +                                   Constants.NSPREFIX_SOAP_ENC +":arrayType");
               attribute.setAttribute(Constants.NSPREFIX_WSDL +":arrayType",
                                      componentTypeName + "[]" );
           } else {
               if (isEnumClass(type)) {
                   writeEnumType(qName, type);
               } else {
  -                writeBeanClassType(qName, type);
  +                if (ser != null)
  +                    ser.writeSchema(this);
  +                else
  +                    writeBeanClassType(qName, type);
               }
           }
           return prefixedName;
       }
  -    
  +
       /**
        * Returns true if indicated type matches the JAX-RPC enumeration class.
        * Note: supports JSR 101 version 0.6 Public Draft
  @@ -387,17 +404,22 @@
           try {
               java.lang.reflect.Method m  = cls.getMethod("getValue", null);
               java.lang.reflect.Method m2 = cls.getMethod("toString", null);
  -            java.lang.reflect.Method m3 = cls.getMethod("fromString",
  -                                                        new Class[] 
{java.lang.String.class});
  +            java.lang.reflect.Method m3 =
  +                    cls.getMethod("fromString",
  +                                  new Class[] {java.lang.String.class});
   
               if (m != null && m2 != null && m3 != null &&
  -                cls.getMethod("fromValue", new Class[] {m.getReturnType()}) != 
null) {
  +                cls.getMethod("fromValue",
  +                              new Class[] {m.getReturnType()}) != null) {
                   try {
  -                    if (cls.getMethod("setValue",  new Class[] {m.getReturnType()}) 
== null)
  +                    if (cls.getMethod("setValue",
  +                                      new Class[] {m.getReturnType()}) == null)
                           return true;
                       return false;
                   } catch (java.lang.NoSuchMethodException e) {
  -                    return true;  // getValue & fromValue exist.  setValue does not 
exist.  Thus return true. 
  +                    // getValue & fromValue exist.  setValue does not exist.
  +                    // Thus return true.
  +                    return true;
                   }
               }
           } catch (java.lang.NoSuchMethodException e) {}
  @@ -432,8 +454,9 @@
               Field field = fields[i];
               int mod = field.getModifiers();
   
  -            // Inspect each public static final field of the same type as the base
  -            if (Modifier.isPublic(mod) && 
  +            // Inspect each public static final field of the same type
  +            // as the base
  +            if (Modifier.isPublic(mod) &&
                   Modifier.isStatic(mod) &&
                   Modifier.isFinal(mod) &&
                   field.getType() == base) {
  @@ -441,18 +464,46 @@
                   Element enumeration = docHolder.createElement("enumeration");
                   enumeration.setAttribute("value", field.get(null).toString());
                   restriction.appendChild(enumeration);
  -                
  +
               }
           }
   
       }
   
       /**
  +     * Create Element
  +     * @param qName the namespace of the created element
  +     * @param elementType schema type representation of the element
  +     * @param nullable nillable attribute of the element
  +     * @return the created Element
  +     */
  +    private Element createRootElement(QName qName,
  +                                      String elementType,
  +                                      boolean nullable) {
  +        if (!addToElementsList(qName))
  +            return null;
  +
  +        Element element = docHolder.createElement("element");
  +
  +        //Generate an element name that matches the type.
  +        // Previously a unique element name was generated.
  +        //String name = generateUniqueElementName(qName);
  +        String name = elementType.substring(elementType.lastIndexOf(":")+1);
  +
  +        element.setAttribute("name", name);
  +        if (nullable)
  +            element.setAttribute("nillable", "true");
  +        element.setAttribute("type", elementType);
  +        return element;
  +    }
  +
  +    /**
        * Write Bean Class Complex Type
        * @param qname QName of type.
        * @param type class of type
        */
  -    private void writeBeanClassType(QName qName, Class cls)  throws Exception  {
  +    public void writeBeanClassType(javax.wsdl.QName qName, Class cls)
  +            throws Exception  {
           // ComplexType representation of bean class
           Element complexType = docHolder.createElement("complexType");
           writeSchemaElement(qName, complexType);
  @@ -479,11 +530,11 @@
           // Add fields under all element
           Element all = docHolder.createElement("all");
           e.appendChild(all);
  -        
  +
           // Build a ClassRep that represents the bean class.  This
           // allows users to provide their own field mapping.
           ClassRep clsRep = beanBuilder.build(cls);
  -        
  +
           // Write out fields
           Vector fields = clsRep.getFields();
           for (int i=0; i < fields.size(); i++) {
  @@ -501,9 +552,15 @@
        * @param where location for the generated schema node
        * @throws Exception
        */
  -    private void writeField(String fieldName, Class fieldType, boolean isUnbounded, 
Element where) throws Exception {
  +    private void writeField(String fieldName,
  +                            Class fieldType,
  +                            boolean isUnbounded,
  +                            Element where) throws Exception {
           String elementType = writeType(fieldType);
  -        Element elem = createElement(fieldName, elementType, isNullable(fieldType));
  +        Element elem = createElement(fieldName,
  +                                     elementType,
  +                                     isNullable(fieldType),
  +                                     where.getOwnerDocument());
           if (isUnbounded) {
               elem.setAttribute("maxOccurs", "unbounded");
           }
  @@ -511,38 +568,16 @@
       }
   
       /**
  -     * Create Element
  -     * @param qName the namespace of the created element
  -     * @param elementType schema type representation of the element
  -     * @param nullable nillable attribute of the element
  -     * @return the created Element
  -     */
  -    private Element createRootElement(QName qName, String elementType, boolean 
nullable) {
  -        if (!addToElementsList(qName))
  -            return null;
  -
  -        Element element = docHolder.createElement("element");
  -
  -        //Generate an element name that matches the type.
  -        // Previously a unique element name was generated.
  -        //String name = generateUniqueElementName(qName);
  -        String name = elementType.substring(elementType.lastIndexOf(":")+1);
  -
  -        element.setAttribute("name", name);
  -        if (nullable)
  -            element.setAttribute("nillable", "true");
  -        element.setAttribute("type", elementType);
  -        return element;
  -    }
  -
  -    /**
        * Create Element with a given name and type
        * @param elementName the name of the created element
        * @param elementType schema type representation of the element
        * @param nullable nullable attribute of the element
        * @return the created Element
        */
  -    private Element createElement(String elementName, String elementType, boolean 
nullable) {
  +    private Element createElement(String elementName,
  +                                  String elementType,
  +                                  boolean nullable,
  +                                  Document docHolder) {
           Element element = docHolder.createElement("element");
           element.setAttribute("name", elementName);
           if (nullable)
  @@ -551,12 +586,13 @@
           return element;
       }
   
  +
       /**
        * convert from JAX-RPC QName to WSDL QName
        * @param qName JAX-RPC QName
        * @return WSDL QName
        */
  -    private QName getWsdlQName (javax.xml.rpc.namespace.QName qName) {
  +    public QName getWsdlQName (javax.xml.rpc.namespace.QName qName) {
           return new QName(qName.getNamespaceURI(), qName.getLocalPart());
       }
   
  @@ -654,7 +690,7 @@
               }
           }
   
  -        // If addded, look at the namespace uri to see if the schema element should 
be 
  +        // If addded, look at the namespace uri to see if the schema element should 
be
           // generated.
           if (added) {
               String prefix = namespaces.getCreatePrefix(qName.getNamespaceURI());
  @@ -697,7 +733,7 @@
           }
           return added;
       }
  -  
  +
   
       /**
        * Determines if the field is nullable. All non-primitives are Nullable
  @@ -721,7 +757,7 @@
       private void createDocumentFragment () {
           this.docHolder = XMLUtils.newDocument();
       }
  -    
  +
       /**
        * Inserts the type fragment into the given wsdl document
        * @param doc
  @@ -732,5 +768,13 @@
                             doc.importNode(wsdlTypesElem, true),
                             doc.getDocumentElement().getFirstChild());
           }
  +    }
  +
  +    /**
  +     * Create a DOM Element in this context
  +     */
  +    public Element createElement(String elementName)
  +    {
  +        return docHolder.createElement(elementName);
       }
   }
  
  
  
  1.12      +18 -4     xml-axis/java/test/encoding/DataSer.java
  
  Index: DataSer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/DataSer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DataSer.java      26 Jan 2002 02:52:38 -0000      1.11
  +++ DataSer.java      2 Feb 2002 18:06:19 -0000       1.12
  @@ -7,6 +7,7 @@
   import org.xml.sax.Attributes;
   import org.xml.sax.SAXException;
   import org.apache.axis.Constants;
  +import org.apache.axis.wsdl.fromJava.Types;
   
   import javax.xml.rpc.namespace.QName;
   import java.io.IOException;
  @@ -16,12 +17,12 @@
   {
       public static final String STRINGMEMBER = "stringMember";
       public static final String FLOATMEMBER = "floatMember";
  -    
  +
       /** SERIALIZER STUFF
        */
       /**
  -     * Serialize an element named name, with the indicated attributes 
  -     * and value.  
  +     * Serialize an element named name, with the indicated attributes
  +     * and value.
        * @param name is the element name
        * @param attributes are the attributes...serialize is free to add more.
        * @param value is the value
  @@ -34,11 +35,24 @@
           if (!(value instanceof Data))
               throw new IOException("Can't serialize a " + value.getClass().getName() 
+ " with a DataSerializer.");
           Data data = (Data)value;
  -        
  +
           context.startElement(name, attributes);
           context.serialize(new QName("", STRINGMEMBER), null, data.stringMember, 
String.class);
           context.serialize(new QName("", FLOATMEMBER), null, data.floatMember, 
float.class);
           context.endElement();
       }
       public String getMechanismType() { return Constants.AXIS_SAX; }
  +
  +    /**
  +     * Return XML schema for the specified type, suitable for insertion into
  +     * the <types> element of a WSDL document.
  +     *
  +     * @param types the Java2WSDL Types object which holds the context
  +     *              for the WSDL being generated.
  +     * @return true if we wrote a schema, false if we didn't.
  +     * @see org.apache.axis.wsdl.fromJava.Types
  +     */
  +    public boolean writeSchema(Types types) throws Exception {
  +        return false;
  +    }
   }
  
  
  


Reply via email to