C#-JAVA Compatibility problem of Date type

  • Thread starter Thread starter LandWolf
  • Start date Start date
L

LandWolf

Hi,
I have a Web services write in Java and I want to write a client in C#.
My web services work with Weather prevision. Hence, I set a date and my
web services return the prevision for that date. When the web service
return the date, this date is wrong.

Es:
Choose date: 24-apr-2006
Responce of Web service: day: 23-apr-2006, condition: sunny,
temperature: 28

The date that Web servis return is always back of a day!!!!!

How is possible? I think there is some problem of compatibility....
In wsdl I use the type xsd:datetime

Please, can someone help me?

Thanks,
LandWolf.
 
...
I have a Web services write in Java and I want to write a client in C#.
My web services work with Weather prevision. Hence, I set a date and my
web services return the prevision for that date. When the web service
return the date, this date is wrong.

Es:
Choose date: 24-apr-2006
Responce of Web service: day: 23-apr-2006, condition: sunny,
temperature: 28

The date that Web servis return is always back of a day!!!!!

How is possible? I think there is some problem of compatibility....
In wsdl I use the type xsd:datetime

Please, can someone help me?

I can at least provide an explanation.

We have different TimeZones over the world, so an instance of DateTime used
in two different TimeZones, will yield the *wrong* Date and Time in one of
them, as the .NET DateTime doesn't take the timezones into consideration.

In Java, a Date is internally storing the UTC-time, which means that it will
always be "correct" all over the world; 2006-04-23 23:00 in London *is* the
same as 2006-04-24 01:00 in Stockholm.

This means that when you "send a DateTime instance across the border", it
will simply have the wrong internal date and time...

Now, I don't know how the Java Webservice is written, where it is located,
and I don't know how you call it, but one possible solution might be to
convert your local DateTime in your client into a DateTime instance in
UTC-time before you call the webservice.


// Bjorn A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top