Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

RPC::XML::Client question

by Sinister (Friar)
on Jan 06, 2004 at 13:14 UTC ( #319104=perlquestion: print w/ replies, xml ) Need Help??
Sinister has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am fidling around with RPC::XML (an xml-rpc implementation for Perl) - which seemed the most usable of xml-rpc/soap thingies out there in the perl world.

However; it is not really working...

I have a test server and client doing a simple 'system.listMethods' - but the result is empty. Now I know the documentation says:

"If the return value from send_request is not a reference, then it can only mean an error on the client-side (a local problem with the arguments and/or syntax, or a transport problem)."

But I don't realy see what's wrong with this code:
#!/opt/perl/bin/perl -Tl use warnings; use strict; use RPC::XML::Client; my $client = RPC::XML::Client->new('http://localhost:8000/'); my $result = $client->send_request('system.listMethods'); die $result unless defined($result); die $result; die $result->code . ': ' . $result->string if $result->is_fault; print join(' ', @{$result->value}), "\n";
This gracefully dies with: Died at ./client.pl line 11.

What's more; using tcpflow (i know - evil) i can see a succesfull POST including a good return containing valid XML. (tried to validate it with XML::Parser, which works like a charm)

So a transport problem doesn't seem to be the problem either.

Any suggestions on how I can (tackle || find the root of) this problem?


er formait hyarya.
-- "Life is a house and the next tornado is never far away"
-- "lovely by nature"

Comment on RPC::XML::Client question
Download Code
Re: RPC::XML::Client question
by Roger (Parson) on Jan 06, 2004 at 13:32 UTC
    You could use the Data::Dumper module to inspect the returned $result structure.
    use Data::Dumper; ... my $result = $client->send_request...; print Dumper($result);
      But that's just the problem. $result = ''; It is defined, but still very much so empty... It's not even a reference :-(


      er formait hyarya.
      -- "Life is a house and the next tornado is never far away"
      -- "lovely by nature"

        Did you check if the $client is built properly? You could add another print Dumper($client);. I just think the line my $client = RPC::XML::Client->new('http://localhost:8000/'); looks doggy, don't you need to specify the name of the service in the URL? Something like 'http://localhost:8000/cgi-bin/rpcserver'.

        And you could also invoke the perl debugger and step into the send_request method, and see step by step what is happenning inside the module. Are you on Linux? If so, you could just invoke the ddd visual debugger by specifying -perl on the commandline, together with the name of your script.

Re: RPC::XML::Client question
by mirod (Canon) on Jan 06, 2004 at 15:45 UTC
    I am fidling around with RPC::XML (an xml-rpc implementation for Perl) - which seemed the most usable of xml-rpc/soap thingies out there in the perl world.

    Are you sure XML::RPC is easier to use than SOAP::Lite? I have little practical experience in the domain, but it looks like SOAP::Lite is quite easy to use, and soaplite.com has quite a bit of documentation, including a cookbook.

    For both SOAP::Lite and XML::RPC you could read Programming Web Services with Perl, and have a look at the companion website.

Re: RPC::XML::Client question
by Sinister (Friar) on Jan 06, 2004 at 16:01 UTC
    Hhmzz ... i found my problem the '-l' switch was in the shebang of the server.

    *hangs head in shame*



    er formait hyarya.
    -- "Life is a house and the next tornado is never far away"
    -- "lovely by nature"

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://319104]
Approved by Roger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2014-08-20 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (111 votes), past polls