Thomas,

I don't think Axis is doing the right thing here and I believe there is a bug open on 
this.  Feel free to investigate and fix this.

The problem is java.utils.Date is a date/time value, not just a calendar date.  So 
information is lost if you serialize a Date as xsd:date, which is why JAX-RPC says 
xsd:dateTime.

But on the other hand, we wanted a mapping for xsd:date, so we used java.util.Date, 
which is OK one way (WSDL -> Java), but not for the round trip (Java -> WSDL), and the 
Java -> XML trip.

The simple solution is to use org.apache.axis.types.Date to do the explicit mapping.  
Not the most friendly to those who are expecting the xsd:date -> Date mapping, but the 
types map 1:1 so there never is a problem.

The more complex (better?) solution is to make sure Axis maintains enough meta-data 
about the XML Schema type of the java.utils.Date in the type/signature/etc to *know* 
that it should serialize this Date as xsd:date, not dateTime.  This would be 'magic' 
and not a precise, but users would be (mostly) happy as the right thing would happen 
for those starting with WSDL.  I am not sure if this is 100% possible.

In any case, I am sure you will come up with the best solution possible. :-)

-- 
Tom Jordahl 
Macromedia Server Development 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:thomas.cherel@;ascentialsoftware.com]
Sent: Thursday, October 31, 2002 10:18 PM
To: [EMAIL PROTECTED]
Subject: xsd:dateTime, xsd:date and wsdl2java




Something that I am not sure to understand. 
I have a WSDL file defining an rpc, SOAP encoded operation. 
One of the input argument is taking a complex type which has a field declared in the 
schema as xsd:date. 
WSDL2Java generates a Java class and java.util.Date is used for the xsd:date field. 
But when running the client code, in the generated SOAP body, xsd:dateTime is used for 
the xsi:type attribute of this field.
I understand that this is coming from the jaxrpc spec which says that java.util.Date 
is mapped to xsd:dateTime, but then WSDL2Java should not generate a java.util.Date for 
an xsd:date. May be something like an org.apache.types.Date (like it is done for 
xsd:time) would be better, no?
I am using Axis 1.0-RC1, I did not check if the problem is the same with Axis 1.0. 
Thomas 

Reply via email to