You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Elliot Metsger <em...@jhu.edu> on 2004/12/09 18:14:44 UTC

Extending xsd:dateTime using WSDL2Java

Everyone,

I've got a wsdl that extends xsd:dateTime, and lets pretend for the time 
being that I am not able to modify the wsdl:

<xsd:extension base="xsd:dateTime">
   <xsd:all>
     <xsd:element name="nanos" type="xsd:int"/>
   </xsd:all>
</xsd:extension>

I'm trying to use WSDL2Java (from Axis 1.2 RC2) to generate stubs.  The 
generated Java code for this extension of xsd:dateTime looks like:
public class Timestamp
   extends java.util.Calendar
   implements java.io.Serializable {
   ...
}

java.util.Calendar defines a number of abstract methods.  The generated 
code  which extends the Calander does not override these abstract 
methods, so compiling the stubs fails.

I can hand-edit the generated code and extend 
java.util.GregorianCalendar instead of java.util.Calendar. 
GregorianCalendar has implementations of the abstract methods, so the 
compilation succeeds.

My question is what is the best way to solve this issue?  Is this an 
Axis bug, since the abstract methods are not overridden while extending? 
  Or is this expected behavior and I should adjust the wsdl (which I'm 
pretending that I cannot do).  Or is modifying the generated code 
accepted way of doing things?

Thanks!

Elliot