File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes Date Problem in Webservices Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Date Problem in Webservices" Watch "Date Problem in Webservices" New topic

Date Problem in Webservices

maoushuk Imran

Joined: Jul 01, 2009
Posts: 6
I ve a weird problem while sending date through webservices. whatever date i'm setting is not sent properly. its always 1 day less than the original. Cod eis below with example.

calender = Calendar.getInstance(TimeZone.getTimeZone("UTC"));

if i print 'objDocHeaderBean.getCreationDate()' its correct (2009-06-30) . but when i send in webservices its one day less than the original (2009-06-29T00:00:00.000+00:00).

Please Help me @ the earliest. I think there is some problem with the UTC thing. Can any1 help me???
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
Have you checked the serialized message on the wire (ie. the SOAP message, if it is a SOAP web service)?
Is the date correct there or do the error occur when the data is being serialized?
Have you seen the class javax.xml.datatype.XMLGregorianCalendar, which, as far as I know, is more suitable for use with web services? Perhaps giving this class a try can solve your problem.
Best wishes!
I agree. Here's the link:
subject: Date Problem in Webservices
It's not a secret anymore!