File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes java.util.Date in axis Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "java.util.Date in axis" Watch "java.util.Date in axis" New topic

java.util.Date in axis

karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
hi all

i am new to sopa/ws/axis and trying to implement a simple time service. i have built an working service which returns the time in milliseconds (a long) which works but when i try to return a java.util.Date object, then i get a class cast exception (i use springframework and its webservice support proxies).

after some searching i found an article that says that axis will serialize Date objects perfectly but will create a java.util.Calendar on deserializing. is this true ? how can i change this ? any hints for how to do this in spring ?

thanks for your help

Joe Miller

Joined: Jul 13, 2000
Posts: 5
Instead of returning time in milliseconds, can you format the date in W3C format and return a string?

karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388

yes, since this is just a test i can format the return in whatever format i want to....
but i want to return a java util date (this is a test of several remoting mechanism including springs httpinvoker, hessian, burlap and rmi and they all work without any troubles with java.util.Date).
this is more a "i'm sure this is possible; i must be doing something wrong" thing :-)

so how do i return a java.util.Date with axis ? the doco says it's supported but i found this article which says that Date does not roundtrip.

but again since this is just a demo i might swallow my prode and use java.util.Calendar instead :-)

thanks for your help....

I agree. Here's the link:
subject: java.util.Date in axis
It's not a secret anymore!