aspose file tools*
The moose likes Web Services and the fly likes argument type mismatch problem using java.util.Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "argument type mismatch problem using java.util.Date" Watch "argument type mismatch problem using java.util.Date" New topic
Author

argument type mismatch problem using java.util.Date

Calvin Kong
Ranch Hand

Joined: Jul 02, 2003
Posts: 37
Hi, I'm new to WebServices and I'm using axis and the WSDL2Java tool to generate java client for testing. I got this error when I try to pass an bean object that has a field using java.util.Date.

- Could not convert java.util.Date to bean field 'dobDate', type java.util.Calendar
- Exception:
java.lang.IllegalArgumentException: argument type mismatch

The WSDL works fot C# client, but not for the Java client. I tried using GregorianCalendar instead, and the problem in Java client went away, but it become a problem for the C# client because it couldn't get the date.
Can anybody help me on this? Thanks you so much!!
Calvin


Cal<br />SCJP,SCWCD,SCBCD
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12836
    
    5
I suspect you won't be able to get Java and C# to agree on a class to represent a datae.
Maybe you would be better off with integer year, month and day or something similar.
Bill
Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 128

Hi Kong,
The reason for this is probably when you install the webservice in the Axis the wsdl that gets generated, replaces the date Object with the Calander, I had a similar problem and all I did was that I replaced the date with Calendar.
it is strange though, because axis has both the Date and the Calendar serializers.
This can be probably be changed if you specify the typemapping or beanmapping for the date Object specifically in the deployment descriptor (WSDD).
try it.
Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202
Originally posted by William Brogden:
I suspect you won't be able to get Java and C# to agree on a class to represent a datae.
Maybe you would be better off with integer year, month and day or something similar.
Bill

There should be standard classes in both languages, mapping to the standard xs:datetime web-service type, should there not?
[ March 25, 2004: Message edited by: Billybob Marshall ]
Calvin Kong
Ranch Hand

Joined: Jul 02, 2003
Posts: 37
it's kinda late response but thank you all!
Calvin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: argument type mismatch problem using java.util.Date