XML-RPC - java.lang.ClassCastException: java.util.Date error during execute

Discussion in 'Java' started by mgalaty, Sep 10, 2004.

  1. mgalaty

    mgalaty Guest

    Hello,

    I am getting an error "XML-RPC - java.lang.ClassCastException:
    java.util.Date" when I call the "XmlRpcClient" execute method. I
    believe the underlying classes are having trouble parsing the result
    from the time.xmlrpc.com/RPC2:80 XML-RPC service.

    I apologize that I could not navigate the Apache bug reporting and
    search system. I hope someone can recognize what is up with this.

    Thank you in advance for any help,

    Michael

    import java.util.Vector;
    import java.util.Hashtable;
    import org.apache.xmlrpc.*;

    public class GetTime {
    private final static String server_url
    ="http://time.xmlrpc.com/RPC2";
    public static void main (String [] args) {
    try {

    XmlRpcClient server = new XmlRpcClient(server_url);
    Vector params = new Vector();

    System.out.println("Calling execute method ");
    Hashtable response = new Hashtable();
    response = (Hashtable)
    server.execute("currentTime.getCurrentTime",params);
    System.out.println("Time is: ");

    } catch (XmlRpcException exception) {
    System.err.println("GetTime1: XML-RPC Fault #" +
    Integer.toString(exception.code) + ": " + exception.toString());

    } catch (Exception exception) {
    System.err.println("GetTime2: " + exception.toString());
    }
    }
    }

    Note: This is similar to this post, but NOT the same.
    http://groups.google.com/groups?hl=...04081102.10e66eb4%40posting.google.com&rnum=1
    mgalaty, Sep 10, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page