Solved

axis webservice problem

Posted on 2007-12-02
6
812 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
best (free) software to access postgres db (java) 1 32
java  and programming certification ? 4 86
replace a word with other 1 40
diffSum example 4 24
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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:

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now