Solved

axis webservice problem

Posted on 2007-12-02
6
821 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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…
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 how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

773 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