0
votes

How does JAX-WS map an XML schema date (xs:dateTime) to a Java Date? In particular, if a JAX-WS server receives an xs:dateTime that contains a time zone, does JAX-WS translate the date to the server time zone? For example, suppose a server running JAX-WS is given an XML date of 2010-08-20T00:00:00-04:00 and the server operates in time zone UTC-5, after JAX-WS maps the date to Java Date property now, what string would now.toString() produce?

Given a collection of XML dates as input, JAX-WS will map these to a collection of Java Date objects, but in the log, to my surprise I see a mix of EST and EDT time zones when what I expect to see is all dates in EST, the current host time zone.

1
Yes, I have, but I observe the strange behaviour that I describe in the comments to stackoverflow.com/questions/4199217/…. - Derek Mahar

1 Answers

3
votes

Date.toString() prints the time with respect to the server's timezone.

E.g.

SimpleTimeZone stz = new SimpleTimeZone(-18000000, "UTC-5");
TimeZone.setDefault(stz);

Means that all calls to Date.toString() will be of the format Fri Jan 01 0:00:00 GMT-5:00 2010

Consequently, if you had a web service that took in an input Date and returned it without any changes, it would be changed to match the server's timezone.

If you have any further questions, I'd suggest you just play with it yourself.