ws-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Rimov" <rim...@centercomp.com>
Subject Methods Returning Dates
Date Mon, 19 Jun 2006 04:46:52 GMT
Hi All,

 

Environment: Nightly XML-RPC, JDK 1.5, WS-Commons-Util 1.0, Extensions
Enabled (So I can invoke functions that have return-type void)

 

First off, this is a really great library to be working with: it is my first
stab at XML-RPC, and compared to working with certain other projects
(no-names --- but I'm starting to think it should be called the "Axis of
Just as Evil"  :-) ), XML-RPC is an absolute joy to work with (even for an
alpha!!!!).  In a single evening, I got a wrapper around XMLRpcServletServer
working so I can now invoke my home-grown front-controller framework
straight through XML-RPC.  I really enjoyed working with the extension
points you've provided.  Way cool. :)

 

So thank you guys very much for providing it and after upgrading to the
nightly, 

 

Ok, onto my questions

 

The method I'm trying to invoke is:

 

    public Date execute() {

        return new Date();

    }

 

But I'm getting a stack [partial] trace.

 

java.lang.ClassCastException: java.util.Date

            at
org.apache.ws.commons.util.XsDateTimeFormat.format(XsDateTimeFormat.java:264
)

            at java.text.Format.format(Format.java:133)

            at
org.apache.xmlrpc.serializer.DateSerializer.write(DateSerializer.java:31)

            at
org.apache.xmlrpc.serializer.XmlRpcWriter.writeValue(XmlRpcWriter.java:144)

            at
org.apache.xmlrpc.serializer.XmlRpcWriter.write(XmlRpcWriter.java:99)

            at
org.apache.xmlrpc.server.XmlRpcStreamServer.writeResponse(XmlRpcStreamServer
.java:89)

            at
org.apache.xmlrpc.server.XmlRpcStreamServer.execute(XmlRpcStreamServer.java:
221)

            at
org.apache.xmlrpc.webserver.XmlRpcServletServer.execute(XmlRpcServletServer.
java:91)

 

I downloaded the source and took a look at where it was getting thrown and
found out that it appears DateSerializer is passing in java.util.Date, and
the XSDateTimeFormat routine is expecting a Calendar.?

 

If I change the method's signature to 

 

public Calendar execute() {

            return Calendar.getInstance();

}

 

Then 

 

XmlRpcWriter.typeFactory.getSerializer(config, pObject); 

 

Is returning a SerializableSerializer instead of a DateSerializer.

 

 

Looking at the code, I THINK this one is due to the fact that 

 

TypeFactory.getSerializer(XmlRpcStreamConfig pConfig, Object pObject) throws
SAXException { } has no line for if (object instanceof Calendar) {.}  (There
is one for Date)

 

 

Thoughts?  Are they jira-able, or is it the ever popular case of newbie
library misuse?

 

Thanks!

 
-Mike

 


Mime
View raw message