Solved

xml-rpc troubleshooting

Posted on 2009-05-12
13
845 Views
Last Modified: 2012-05-06
Since a few days back I get the following error during an xml-rpc call:

Transport error:
no element found at line 1, column 0, byte -1 at /usr/lib/perl5/site_perl/5.8.8/RPC/XML/Client.pm line 365
-------------------------------------------------------------------------------------------

If I make a request to the xml-rpc server with a citycode that does not exist, I get the following dump output:
-------------------
Content-type: text/html

$VAR1 = {
          'faultString' => xml.getCities: no cities found',
          'faultCode' => '1004'
        };
------------------------------------

What could cause the above mentioned error?
use Data::Dumper;
use RPC::XML::Client;
 
#create the client application
my $client = RPC::XML::Client->new(
        'https://user:pwassword@distr-xml.domain.com/xml-rpc', error_handler => sub { die "Transport error: $_[0]" });
print "Content-type: text/html\n\n";
print Dumper $client->simple_request(
        'xml.getCities',
        {rows=>1000,offset=>0,city_ids=>'-3414440'}
);
 
exit;

Open in new window

0
Comment
Question by:migarama1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 2
13 Comments
 
LVL 8

Expert Comment

by:mostart
ID: 24364303
could you post your /usr/lib/perl5/site_perl/5.8.8/RPC/XML/Client.pm file here (or at least that region around line 365..
0
 

Author Comment

by:migarama1
ID: 24364338
.....
    if ($message = $response->headers->header('X-Died'))
    {
        # One of the die's was triggered
        return (ref($self->error_handler) eq 'CODE') ?
            $self->error_handler->($message) : $message;
    }
    unless ($response->is_success)
    {
        $message =  "$me: HTTP server error: " . $response->message;
        return (ref($self->error_handler) eq 'CODE') ?
            $self->error_handler->($message) : $message;
    }

    # Whee. No errors from the callback or the server. Finalize the parsing
    # process.
    eval { $value = $parser->parse_done(); };            ############ THIS IS LINE 365  ##############
    if ($@)
    {
        # One of the die's was triggered
        return (ref($self->error_handler) eq 'CODE') ?
            $self->error_handler->($@) : $@;
    }

    # Check if there is a callback to be invoked in the case of
    # errors or faults
    if (! ref($value))
    {
        $message =  "$me: parse-level error: $value";
        return (ref($self->error_handler) eq 'CODE') ?
            $self->error_handler->($message) : $message;
    }
    elsif ($value->is_fault)
    {
        return (ref($self->fault_handler) eq 'CODE') ?
            $self->fault_handler->($value->value) : $value->value;
    }

    $value->value;
}
.......
0
 
LVL 8

Assisted Solution

by:mostart
mostart earned 50 total points
ID: 24364411
hmm.. its kind of hard to help you like this, since this is so much inside the core.

line 365 points us to the function called $parser->parse_done();
Thats the function which dies.

You could do two things:
1.) try to think about anything that changed before the error first occured. Any perl package updates ? and so on.

2.) Follow the error by look into the function I mentioned above to see why it dies.  
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:migarama1
ID: 24364554
yes, and i have also first to check if the problem occurs on the server- or client side.

As I don't have admin access to the xml-rpc server, I'd have to check it with another xml-rpc client.

What would be the easiest way to check this? is there somewhere a simple windows client to download?
0
 
LVL 39

Expert Comment

by:Adam314
ID: 24365610
What is your version of XML::RPC::Client?
perl -MXML::RPC::Client -e 'print "XML::RPC::Client::$VERSION\n"'

Open in new window

0
 

Author Comment

by:migarama1
ID: 24365909
I don't get a 'Version'-answer back

This is the output
perl -MRPC::XML::Client -e 'print "XML::RPC::Client::$VERSION\n"'
XML::RPC::Client::






perl -MXML::RPC::Client -e 'print "XML::RPC::Client::$VERSION\n"'

returns

Can't locate XML/RPC/Client.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .).
BEGIN failed--compilation aborted.
0
 

Author Comment

by:migarama1
ID: 24366197
/usr/lib/perl5/site_perl/5.8.8/RPC/XML/Client.pm

Version 1.22

###############################################################################
#
# This file copyright (c) 2001 by Randy J. Ray <rjray@blackperl.com>,
# all rights reserved
#
# Copying and distribution are permitted under the terms of the Artistic
# License as distributed with Perl versions 5.002 and later. See
# http://www.opensource.org/licenses/artistic-license.php
#
###############################################################################
#
#   $Id: Client.pm,v 1.22 2004/12/09 08:50:17 rjray Exp $
#
#   Description:    This class implements an RPC::XML client, using LWP to
#                   manage the underlying communication protocols. It relies
#                   on the RPC::XML transaction core for data management.
#
#   Functions:      new
#                   send_request
#                   simple_request
#                   uri
#                   useragent
#                   request
#
#   Libraries:      LWP::UserAgent
#                   HTTP::Request
#                   URI
#                   RPC::XML
#
#   Global Consts:  $VERSION
#
###############################################################################

package RPC::XML::Client;

use 5.005;
use strict;
use vars qw($VERSION);
use subs qw(new simple_request send_request uri useragent request
            fault_handler error_handler combined_handler);
                                                           
0
 
LVL 39

Expert Comment

by:Adam314
ID: 24370304
Sorry, I had the module named reversed... it should have been RPC::XML::Client, not XML::RPC::Client.

Anyways, it appears you have version 1.22.  The latest on cpan is version 1.24.  It's possible you've found a bug in the module which has been fixed by a newer version.  Can you upgrade to the latest, and try again?
perl -MRPC::XML::Client -e 'print "RPC::XML::Client::$VERSION\n"'

Open in new window

0
 

Author Comment

by:migarama1
ID: 24371952
This has been done yesterday. I upgraded from RPC::XML 0.59  to RPC::XML 0.64 that includes Client.pm 1.24


However, if I execute
perl -MRPC::XML::Client -e 'print "RPC::XML::Client::$VERSION\n"'

I get back "RPC::XML::Client::"          (version number is missing)

no matter if executed as normal user or as root


I first thought the problem could be on the server side. Does above inidicate, that something with my RPC::XML module installation is wrong?

Regards
0
 

Author Comment

by:migarama1
ID: 24371966
appendix:

Still getting the following error with the new version:

Problem: no element found at line 1, column 0, byte -1 at /usr/lib/perl5/site_perl/5.8.8/RPC/XML/Client.pm line 363
0
 
LVL 39

Accepted Solution

by:
Adam314 earned 200 total points
ID: 24415932
The problem appears to be in the Client module.  You might try submitting a bug on CPAN, and see if you get a response.
0
 

Author Comment

by:migarama1
ID: 24416006
Do you know a client for windows to test the output of an xml-rpc server? As I haven't changed  anything I suspect the error server-side
0
 
LVL 39

Expert Comment

by:Adam314
ID: 24423192
I don't, but google turned up a bunch of results.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question