This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am storing a data with dateTime field with format as "2010-04-20T09:30:47.0+05:00" it get stored successfully but when i retrieve using webservice in response i get it as "2010-04-20T04:30:47.000Z". I want the response in the same way it is stored.
In javaClass i hv used GregorianCalendar as data Type.Is that cause for my problem ?
xsd:dateTime is mapped to java.util.Calendar.
Your stubs on service and client side code should contain accordingly. You need to use java utility methods to format your dates, this has nothing to do with web services.
I see there is a mismatch in the times because of different time zones. You may need to use the right time zone to fix your problem.
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Joined: Dec 05, 2010
Thanks for your reply Naren.
But i have 2 webservices one string based webservice and other Object based webservice.
In string based webservice i get the response in the way in wanted.Even for this i m using the same datatype(GregorianCalendar) for the same field. There it works fine but i m facing this problem only in Object based service where it is getting converted to the UTC Those time mismatch is because of this.
Technically they are equal but i dont want it (2010-04-20T09:30:47.0+05:00) to get converted to UTC(2010-04-20T04:30:47.000Z).
Thanks for your reply Ivan and Naren.
This "((2010-04-20T09:30:47.0+05:00) to get converted to UTC(2010-04-20T04:30:47.000Z))" worked.
But i got a new problem from that.
when i am using this code
calendar = factory.newXMLGregorianCalendar(ConvertToDateFormat("2009-09-12 09:30:47.000000 +00:00")).toGregorianCalendar();
I get the output as 2009-09-12T09:30:47.000+00:00 But i need 2009-09-12T09:30:47.000000Z. i.e only if +00:00 is the time zone then Z should be appended.
Again this works fine with String based wsdl only object based wsdl is having this timestamp problem.