Solved

axis webservice problem

Posted on 2007-12-02
6
832 Views
Last Modified: 2010-05-18
I have an webservice problem.

My WSDL has an entry:

<xs:element name="myLoginDateTime" type="xs:dateTime" minOccurs="0"/>




AXIS has  generated a class which has  property as

private java.util.Calendar myLoginDateTime;




i am setting the myLoginDateTime value from a DB query result like below

java.sql.TimeStamp mylogin=rs.getTimestamp("myLOGIN");
GregorianCalendar cal=new GregorianCalendar();
cal.setTimeInMillis(mylogin.getTime());

System.out.println(cal);---->Line1

Mycustomer.setmyLoginDateTime (cal);



But the webservice response XML has a time difference of approx 3 and 1/2 hours than from printed Line1.


any suggestion ?





0
Comment
Question by:cofactor
6 Comments
 
LVL 4

Expert Comment

by:jcoombes
ID: 20391309
Sounds like there might be a timezone difference between the database and the web-service server....have you checked this?   What are locales on the two machines?   (Assuming that they *are* two different machines of course...)
0
 
LVL 9

Expert Comment

by:ysnky
ID: 20391313
may be it is updated by web service.
0
 

Author Comment

by:cofactor
ID: 20391360
jcoombes:,

i guess like that.

in fact , this question has been asked by one of my  friend . i will  confirm this as soon as i get a response from him.

OK,EVEN  if i assume , web service server has a TIMEZONE set as "GMT+x:y"   and   DB server has a TimeZone set as "GMT+a:b"  

is there a way to  remove this inconsistency ?

do i  need to add the offset ?
If so, whats the extra code need to be to added to  get this discrepancy removed ?

any pointer ?

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cofactor
ID: 20391432
here is the info you need

webserver (sits on windows) has   GMT+3.30

DB server (sits on unix box)  has  IRST

can you please  comment now ?





0
 
LVL 23

Expert Comment

by:cmalakar
ID: 20395813
IRST is +3.30 hrs from GMT..

Hence both timezones are same..

Hence it is clear that Web Server is giving the result in GMT instead of IRST.
0
 
LVL 23

Accepted Solution

by:
cmalakar earned 300 total points
ID: 20395828
To Get the right time, you have to add the GMT offset to the value retrieved...

Calendar obj = Calendar.getInstance();
TimeZone tz = obj.getTimeZone();
int TIMEZONE_OFFSET_VALUE =  tz.getRawOffset() / 1000;

TIMEZONE_OFFSET_VALUE  will give the offset in seconds that you need to use
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question