axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Jordahl" <t...@macromedia.com>
Subject RE: Time zone offset incorrectly handled by Axis, client-side
Date Thu, 20 Oct 2005 00:51:51 GMT
Evlogi,

Can you try to reproduce the problem without Axis in the mix - just
plain Java code?  It sure sounds like there is a daylight savings time
issue in the JVM on the client, nothing to do with Axis at all.

--
Tom Jordahl


-----Original Message-----
From: Evlogi Georgiev [mailto:evlogi@elaide.com] 
Sent: Wednesday, October 19, 2005 10:02 AM
To: axis-dev@ws.apache.org
Subject: Time zone offset incorrectly handled by Axis, client-side

First of all, sorry for that long posting.. but I tried to investigate 
as far as I am able anf fix the issue, or at least workaround it if 
possible.

I have observed a weird problem using Apache Axis.
What I do is basically consuming web service which passes back few
dates.
Server-side is Apache Axis on C++. The client-side is Java Axis 1.3.
The web service machine is on GMT time zone, the SOAP XML it sends look 
perfectly fine - correct dates and GMT times. "Z" is noted as the time 
offset, as it should be.
The client is on local time. The client SOAP code is generated by 
wsdl2java and works fine ... well, until recently :-(

What we have is a service which passes back java Calendar object.
Then client-side code gets time from the GMT Calendar and sets it in a 
local Calendar object:

Calendar localCalendar = Calendar.getInstance();
localCalendar.setTime(calendarInGMTreceivedViaSOAP.getTime());

that piece of code used to work for my timezone Europe/Rome until
01.Oct.
now it fails to add 2 hrs to GMT and adds only 1 hour instead.
Daylight saving time is not an issue, since it will come in force in 
30.Oct.

Investigating the things a little further I started printing out values 
of time in milisec. the code is receiving from the service.
And I found 2 things.

- First, for dates after 01.Oct. the attribute timezone offset was set 
to 60 instead of the normal 120. Here goes the portion of the code:

Calendar localCalendar = Calendar.getInstance();
localCalendar.setTime(calendarInGMTreceivedViaSOAP.getTime());
System.out.println(localCalendar.getTime().getTimezoneOffset());

in the same time we had the same timezone offsets in the Calendar 
object, i.e. the only change was in the timezone offset of the Date 
object which is inside the Calendar

- Second, I've addes some extra debug lines to check what time in 
milisec was given to the incoming Calendar object.. and that is a funny 
thing. Check the code:

Calendar localCalendar = Calendar.getInstance();
System.out.println("localCalendar -- Calendar in msec: 
"+localCalendar.getTimeInMillis()+" Date in msec: 
"+localCalendar.getTime().getTime());
localCalendar.setTime(calendarInGMTreceivedViaSOAP.getTime());
System.out.println("localCalendar -- Calendar in msec: 
"+localCalendar.getTimeInMillis()+" Date in msec: 
"+localCalendar.getTime().getTime());

the output from this code is something like
localCalendar -- Calendar in msec: 1129645434344 Date in msec: 
1129645434344
localCalendar -- Calendar in msec: 1132312612000 Date in msec: 
1132312612000

the funny thing is that the second time should be before the first one, 
since the date is in the past.
But it isn't. And I don't have a clue why not.

In the same time I used nettool to hijack the SOAP XML which is going 
back and forth between the web service and my client code. And I saw the

dates in the XML which is incoming. And they were perfectly fine.
So I think the issue is somewhere in the client side of Axis 
implementation.
But I cannot understand what is it.

For me looks like a bug, but I'll post it here and if I don't get a 
reply within a few days - then I'll add it to your JIRA System.

Thanks and sorry for the inconvenience,
Evlogi


Mime
View raw message