I have 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.
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. The client is on local time. The client SOAP code is generated by wsdl2java and works fine ... well, most of the time ..or until recently :)

What we have is a service which passes back java Calendar object.
Then my 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.

Anyone? Ideas? Any ideas? :)

Thanks in advance!!

Reply via email to