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 Boris Rozenshteyn <ro...@gmail.com> on 2013/11/23 15:14:23 UTC

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

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