Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

argument type mismatch problem using java.util.Date

 
Calvin Kong
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 128
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's kinda late response but thank you all!
Calvin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic