Archive of UserLand's first discussion group, started October 5, 1998.

Is this a valid response?

Author:Skip Montanaro
Posted:1/19/1999; 1:14:13 PM
Topic:Frontier on MacOS X Server
Msg #:2270 (In response to 2255)
Prev/Next:2269 / 2271

I'm still having trouble getting a simple Perl script to chat with Fredrik Lundh's XML RPC Server. After applying the patch he posted, the errors from Perl are reduced but don't go away. Here's a complete example.

I want to look up the lat/long for San Francisco. From Perl I execute

    my $server = Frontier::Client->new(host => $host, port => $port);
    my $method = 'latlong';
    my @args = ("San Francisco", "CA");

$server->call($method, @args);

From Python I execute

    server = xmlrpclib.Server("http://dolphin.calendar.com:8000")
    server.latlong("San Francisco", "CA")

Perl sends the server

    
    
    latlong
    
    San Francisco
    CA
    
    

Python sends

    
    
    latlong
    
    
    San Francisco
    
    
    CA
    
    

Close enough to call the same. The server handles both equally well as far as I can tell. It makes the latlong("San Francisco", "CA") call, which returns the Python tuple (37.775, -122.418333). This gets encoded as an array and the server sends back the following response:

    
    
    
    
    

37.775 -122.418333

The Python client likes that just dandy and displays the Python list [37.775, -122.418333]. The Perl client complains:

    XML::Parser::die(XML::Parser=HASH(0x80e94bc) wanted a data type, got `double')
    XML::Parser::die(XML::Parser=HASH(0x80e94bc) wanted `data', got `value')
    XML::Parser::die(XML::Parser=HASH(0x80e94bc) wanted `value' tag, got `double')

Can anyone see anything wrong with the XML response that would make the Perl code complain? I'm a little perplexed why it doesn't think 'double' is a data type. In comparing it with the sample response at http://www.scripting.com/frontier5/xml/code/rpc.html, it looks to me like a valid response.

A peripherally related question: Why does the tag need a tag embedded in it? A container element that only contains a single element seems a tad redundant to me.

A feature request for people generating XML-RPC encodings: It would be grand if the various encoding libraries all generated a comment in the encoding that indicates the package/version of the generator, something like

(or whatever is a valid XML comment).

Thx,

Skip Montanaro skip@calendar.com


There are responses to this message:


This page was archived on 6/13/2001; 4:47:24 PM.

© Copyright 1998-2001 UserLand Software, Inc.