473,395 Members | 1,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

xsd:datetime problem while calling a java webservice

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
4 21359
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
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
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


"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jens | last post by:
Hello, i am trying to call a Apache WebService, which accepts NULL-Values for some Parameters of a specific Web-Method. NULL-Values are mapped within the soap-request by the .NET Client...
2
by: Daniel Santana | last post by:
Hi again. Now I got a brand new problem using the java webservice. I'm trying to use the wsdl tool of the "Microsoft Visual Studio .Net 2003 Command Prompt"... but I got the same message when...
7
by: Christian Wilhelm | last post by:
Hi! I'm trying to call a Java WebService out of a .net Client. There are two Methods, one Method requires one Parameter of type Parameter, the other Method requires one Parameter of type...
6
by: Sascha Schmidt | last post by:
Hi again! Well, the first part of my "mission" (calling remoting objects from a webservice) is solved. But there's another part: Calling this C#-Webservice from a java client. Is this a...
4
by: Lucvdv | last post by:
I have to connect to a server set up by the government, where they used Apache Axis to create a webservice. The code I use to interface to the webservice is generated by wsdl.exe, based on a...
1
by: jens Jensen | last post by:
Hello , i'm calling a webservice generated with oracle webservice java tools. I'm not able to add a web reference to a .net client the usual way with visual studio 2005. I was therefore...
2
by: Pablo | last post by:
Hi at all! How can i send a DATA (not a DataTime) Type to a Java WebService? In .NET we have only a DataTime that is incompatible with the Data (calendar) Type of Java! How can i resolve this...
4
by: jsnX | last post by:
I'm having trouble determining whether or not the period in an xsd:dateTime like this: 2006-10-04T03:42:12.3Z should in fact be a comma, as date(1) would have it: date --utc --iso-8601=ns...
1
by: parimalb | last post by:
Hi All, I want to pass an array argument to the java webservice from perl client using SOAP::LITE package. Please let me know if anyone knows about this. The web method declaration in java is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.