Data loss when AXIS2 encodes java.util.Date (date and time info) as xs:date (date only)

Boris Rozenshteyn <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CAA=-VhmjhdY7U6i4yYezkGV7NTRPV+EH4TBnhgRtifa5+g0kcg@mail.gmail.com>
Hi everyone!

I've just started working with AXIS2 and faced a weird issue. Sorry if it's
a duplicate, I could not find anything like that in your mail archives.

I found that in AXIS2 (latest rev. 1544704) java.util.Date is represented
in SOAP as 'xs:date'. As far as I can see, it's done in the file
'modules/adb/src/org/apache/axis2/databinding/types/soapencoding/Date.java:169'.
Unfortunately, it breaks the logic of my app, since I treat java.util.Date
as an object for keeping both date and time information (see spec:
http://docs.oracle.com/javase/6/docs/api/java/util/Date.html). Of course,
since it's represented as xs:date in SOAP, the server returns only the date
without the time (it's also done according to XML Schema spec:
http://www.w3schools.com/schema/schema_dtypes_date.asp).

My question is: why the datetime-keeping object (java.util.Date) is
converted to date-only (xs:date) and is there any workaround to keep it
working? The only thing I can see now, it's a bug and AXIS2 should be
patched to represent Date as xs:dateTime (according to XML Schema spec:
http://www.w3schools.com/schema/schema_dtypes_date.asp).

Please let me know what do you think. Sorry if I'm wrong with my findings.

Have a nice day!

Regards,
Boris Rozenshteyn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.