Last week I used the WSDL2Java tool in the released Axis 1.1.  
Today I re-ran the tool from the 1.2_beta2 release.  The code that is generated does not compile and there are some major differences.  Firstly the reason for non-compilation is that one of the generated classes is attempting to extend java.lang.String (which is defined as final).

When I compiled with axis1.1 this problem didn't occur as the generated class extended another generated class which had a private member variable which was the string.  The wsdl imports a number of xsd files one of which defines all the base types that are used by used by other xsd files.  In this there are a number of xsd simpleType elements whose restriction type is one defined earlier in the file and which in itself is an xsd:string.    
For example
<xsd:simpleType name="alpha">
        <xsd:restriction base="xsd:string">
                <xsd:pattern value="...." />
        </xsd:restriction base
</xsd:simpleType>

<xsd:simpleType name="alpha8">
        <xsd:restriction base="alpha">
                <xsd:maxLength value="8"/>
        </xsd:restriction base
</xsd:simpleType>
etc
Using axis 1.1 I get generated java classes for each of these simple types.  For example an Alpha.java and a Alpha8.java with the latter having an instance of the former as a private member.  

With the beta I don't get either of these so that when a more complex type is defined at a later stage in another xsd file, for example
<xsd:element name="ElementName">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="EncodedElement">
        <xsd:complexType>
          <xsd:complexContent>
                <xsd:extensionBase="ns:alpha8">
                     ....
                 </xsd:extensionBase>        
           </xsd:complexContext>
        </xsd:complexType>
        </xsd:element>
        .....
      </xsd:sequence>
  </xsd:sequence>
</xsd:element>
In this case the generated class __ElementName_EncodedElement extends java.lang.String

Is there something different I need to when using WSDL2Java with the 1.2 beta?

Thanks,
Aoife

Reply via email to