xml-rpc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Peierls <...@peierls.net>
Subject Re: need help: cannot marshal <type 'long int'>
Date Fri, 20 Sep 2002 16:50:28 GMT
mike marsh wrote:
> I need to connect to a Zope database via XmlRpc.
> Someone else maintains the xmlrpc methods and code on
> the Zope server.  I try calling a particular method,
> but an XmlRpcException gets thrown.  The exception
> string says "cannot marshal <type 'long int'>".  I
> suppose I need an XmlRpc parser that can interpret
> <long int> and create a Long object.  

This is a limitation of the server, not of your client,
so mucking with the client side parsing won't help you.

The XML-RPC spec (http://xmlrpc.org/spec) doesn't allow
long integer values. The best you can do in general is 
encode the long value as a string with 

    long value = ...;
    String encodedValue = Long.toString(value);

and decode returned string values as longs with

    String value = ...;
    long decodedValue;
    try {
        decodedValue = Long.parseLong(value);
    catch (NumberFormatException e) {
        decodedValue = 0; // or some sentinel value

But this all depends on the server doing the right thing
with string-encoded long values. Check with the database 
maintainer to find out how the Zope database can be used 
via XML-RPC with non-XML-RPC types.


View raw message