Solved

axis webservice problem

Posted on 2007-12-02
6
802 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
Comment Utility
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
Comment Utility
may be it is updated by web service.
0
 

Author Comment

by:cofactor
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:cofactor
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
array6 challenfge 6 62
array11 challenge 16 51
java  and programming certification ? 4 64
@SBGen Method 3 25
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

743 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

18 Experts available now in Live!

Get 1:1 Help Now