Hi
On 25/07/13 14:25, Horváth Márton wrote:
Hi,
I have faced a strange issue when passing a java.util.Date through CXF (version
is 2.7.4) web-service from client to server side. On the client side a
java.util.Date is created (Wed Jul 31 23:59:59 GMT 2013) and passed to the web
service. In the soap request the date is still correct
(2013-07-31T23:59:59.999Z), but when the server side method is called in the
argument the date is changed (Thu Aug 01 01:59:59 CEST 2013). It's off with
plus 2 hours which is I think the difference between GMT and my timezone (CET).
But what and why changes the date this way and how can I avoid this behaviour?
Is this Date passed as part of the soap payload itself ? If so then I
guess you may need to plugin somehow into the way JAXB reads the dates
(XmlJavaTypeAdapter I guess), example, make sure that the same Date
pattern, ex, ensure GMT timezone is set, example:
// replace the string pattern with the one matching Wed Jul 31 23:59:59
GMT 2013:
SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy
HH:mm:ss zzz", Locale.US);
TimeZone tZone = TimeZone.getTimeZone("GMT");
dateFormat.setTimeZone(tZone);
Might help,
Cheers, Sergey
Thank you for your help!
Best regards,
Márton Horváth