By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,974 Members | 1,913 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,974 IT Pros & Developers. It's quick & easy.

xsd:datetime problem while calling a java webservice

P: n/a
Hi
I am using a java webservice in a .NET application. The xml type of a
field in this webservice is xsd:datetime. When i call the webservice
from the application i get a deserialization error on the java
webservice side. It says "Can not create instance of [java.util.Date]
from string [11/22/2005 2:00:00 PM] with schema type
[http://www.w3.org/2001/XMLSchema][dateTime]". Can anyone let me know
what could be the problem.
I am just sending a DateTime object which i get from a VB application
directly to the WebService.

Thanks
Abhishek

Nov 28 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 27 Nov 2005 22:00:20 -0800, lu***********@gmail.com wrote:
Hi
I am using a java webservice in a .NET application. The xml type of a
field in this webservice is xsd:datetime. When i call the webservice
from the application i get a deserialization error on the java
webservice side. It says "Can not create instance of [java.util.Date]
from string [11/22/2005 2:00:00 PM] with schema type
[http://www.w3.org/2001/XMLSchema][dateTime]". Can anyone let me know
what could be the problem.
I am just sending a DateTime object which i get from a VB application
directly to the WebService.


Are you passing the DateTime as a string?
It looks like the webservice is receiving the date in plain English text
format.

When I pass a DateTime in an xsd:dateTime field, the actual string passed
to the server is formatted differently, for example

<myDate xsi:type="xsd:dateTime">2005-11-28T15:13:35.0000000+02:00</myDate>

My VB.Net code was auto-generated by wsdl.exe, from a .wsdl file generated
by Apache Axis (the webservice runs on Apache).
Nov 28 '05 #2

P: n/a
Hi
Actually i was passing the DateTime value coming from the outlook to
the webservice. When i query the outlook using outlook spy it gives me
the Start and End Date as a date object however when i query the
outlook using the outlook object model in C# it gives me the type of
Date as string.
I think something is wrong with the outlook object model. I've found a
work around for this thin for the time being however i am searching for
a perfect way to pass the outlook date directly to the webservice.
any ideas would help ?

Abhishek

Nov 29 '05 #3

P: n/a
DC
The general problem of sharing Dates and times across a webservice interface
is trickier than you are letting on.
In .NET the DateTime type includes timezone, while in Java it does not.
so you have to either make some assumptions about timezones, or explicitly
deal with this in your interface definition.

Another issue is that in .NET, DateTime is a value type which can never be
nil. Whereas in Java this is not the case. A java.util.Calendar (the
default type for AXIS and other web services stacks) can take null as a
value. So, what happens when a Java client or server transmits a response
or request to .NET that contains a nil Date? This is an edge case that
you have to handle. Again, either make assumptions or deal with it
explicitly in code.

But I think maybe you are not interested in addressing the general case.

To address your specific issue, where you get a date back from outlook in
string format, but you need a DateTime object, you can instantiate a
DateTime from a string, with the Parse() or ParseExact() methods.

example:
http://cheeso.members.winisp.net/src...teTimeParse.cs
--
-Dino
D i n o . C h i e s a AT M i c r o s o f t . c o m

<lu***********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi
Actually i was passing the DateTime value coming from the outlook to
the webservice. When i query the outlook using outlook spy it gives me
the Start and End Date as a date object however when i query the
outlook using the outlook object model in C# it gives me the type of
Date as string.
I think something is wrong with the outlook object model. I've found a
work around for this thin for the time being however i am searching for
a perfect way to pass the outlook date directly to the webservice.
any ideas would help ?

Abhishek

Nov 30 '05 #4

P: n/a


"DC" wrote:
The general problem of sharing Dates and times across a webservice interface
is trickier than you are letting on.
In .NET the DateTime type includes timezone, while in Java it does not.
so you have to either make some assumptions about timezones, or explicitly
deal with this in your interface definition.

Another issue is that in .NET, DateTime is a value type which can never be
nil. Whereas in Java this is not the case. A java.util.Calendar (the
default type for AXIS and other web services stacks) can take null as a
value. So, what happens when a Java client or server transmits a response
or request to .NET that contains a nil Date? This is an edge case that
you have to handle. Again, either make assumptions or deal with it
explicitly in code.

But I think maybe you are not interested in addressing the general case.

To address your specific issue, where you get a date back from outlook in
string format, but you need a DateTime object, you can instantiate a
DateTime from a string, with the Parse() or ParseExact() methods.

example:
http://cheeso.members.winisp.net/src...teTimeParse.cs
--
-Dino
D i n o . C h i e s a AT M i c r o s o f t . c o m

<lu***********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Hi
Actually i was passing the DateTime value coming from the outlook to
the webservice. When i query the outlook using outlook spy it gives me
the Start and End Date as a date object however when i query the
outlook using the outlook object model in C# it gives me the type of
Date as string.
I think something is wrong with the outlook object model. I've found a
work around for this thin for the time being however i am searching for
a perfect way to pass the outlook date directly to the webservice.
any ideas would help ?

Abhishek


Jan 9 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.