igors       02/03/06 06:49:49

  Modified:    java/src/org/apache/axis/wsdl/toJava JavaStubWriter.java
                        SchemaUtils.java
  Log:
  Taken care of simple types derived from base types (not enumerations)
  For example like this
  <xsd:simpleType name="myLong">
  <xsd:restriction base="xsd:long"/>
  </xsd:simpleType>
  Previously such derived types were not registered for deserialization,
  so when a SOAP reply comes with myLong it would result in a failure.
  
  Revision  Changes    Path
  1.40      +15 -1     
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java
  
  Index: JavaStubWriter.java
  ===================================================================
  RCS file: 
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaStubWriter.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- JavaStubWriter.java       5 Mar 2002 14:02:13 -0000       1.39
  +++ JavaStubWriter.java       6 Mar 2002 14:49:49 -0000       1.40
  @@ -397,7 +397,10 @@
       private void writeSerializationInit(TypeEntry type) throws IOException {
           // Don't need to register base types or
           // our special collection types for indexed properties
  -        if (type.getBaseType() != null ||
  +        // Note that we still have to register types derived from base types
  +        // This is necessary to be able to properly identify such derived types
  +        // during deserialization
  +        if ((type.getBaseType() != null && type.getRefType() == null) ||
               type instanceof CollectionType) {
               return;
           }
  @@ -437,6 +440,17 @@
               pw.println("            cachedDeserFactories.add(enumdf);");
           } else if (type.isSimpleType()) {
               pw.println("            cachedSerFactories.add(simplesf);");
  +            pw.println("            cachedDeserFactories.add(simpledf);");
  +        } else if (type.getBaseType() != null) {
  +            // serializers are not required for types derived from base types
  +            // java type to qname mapping is anyway established by default
  +            // note that we have to add null to the serfactories vector to
  +            // keep the order of other entries, this is not going to screw
  +            // up because if type mapping returns null for a serialization
  +            // factory, it is assumed to be not-defined and the delegate
  +            // will be checked, the end delegate is DefaultTypeMappingImpl
  +            // that'll get it right with the base type name
  +            pw.println("            cachedSerFactories.add(null);");
               pw.println("            cachedDeserFactories.add(simpledf);");
           } else {
               pw.println("            cachedSerFactories.add(beansf);");
  
  
  
  1.12      +7 -2      xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SchemaUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SchemaUtils.java  27 Feb 2002 13:41:28 -0000      1.11
  +++ SchemaUtils.java  6 Mar 2002 14:49:49 -0000       1.12
  @@ -479,8 +479,7 @@
               // Process the enumeration elements underneath the restriction node
               if (baseEType != null && restrictionNode != null) {
   
  -                Vector v = new Vector();
  -                v.add(baseEType);
  +                Vector v = new Vector();                
                   NodeList enums = restrictionNode.getChildNodes();
                   for (int i=0; i < enums.getLength(); i++) {
                       QName enumKind = Utils.getNodeQName(enums.item(i));
  @@ -496,6 +495,12 @@
                           }
                       }
                   }
  +                
  +                // is this really an enumeration?
  +                if(v.isEmpty()) return null;
  +                
  +                // The first element in the vector is the base type (an TypeEntry).
  +                v.add(0,baseEType);
                   return v;
               }
           }
  
  
  


Reply via email to