Skip Menu |
 

This queue is for tickets about the RPC-XML CPAN distribution.

Report information
The Basics
Id: 100687
Status: open
Priority: 0/
Queue: RPC-XML

People
Owner: rjray [...] blackperl.com
Requestors: lloy0076 [...] adam.com.au
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.78
Fixed in: (no value)



Subject: RPC Client to PHP 5.5.14 xml-rpc server 'parse-level-error'.
Download (untitled) / with headers
text/plain 974b
When using the attached client.pl to call the "hello" method on "index.php" (running under PHP 5.5.14) I get: $VAR1 = 'RPC::XML::Client::send_request: parse-level error: End-of-parse error: No error, methodCall or methodResponse detected'; ...as the response. This XML-RPC server, though, responds correctly to another XML-RPC client written with the Nwc XML RPC Client in C#. Here is a sample output: [Wed Dec 03 21:40:50.552289 2014] [:error] [pid 908] [client 127.0.0.1:49916] <?xml version="1.0" encoding="us-ascii"?><methodCall><methodName>hello</methodName><params></params></methodCall> [Wed Dec 03 21:42:55.918132 2014] [:error] [pid 1205] [client 127.0.0.1:49928] <?xml version="1.0" encoding="utf-8"?><methodCall><methodName>hello</methodName><params><param><value><struct /></value></param></params></methodCall> The first one, encoding in us-ascii is RPC::XML and it gets a response it cannot understand. The second one is generated by C# / Nwc classes.
Subject: client.pl
Download client.pl
text/x-perl 479b
#!/usr/bin/perl use strict; use warnings; use feature ':5.10'; use Carp; use Data::Dumper; use RPC::XML; use RPC::XML::Client; use Scalar::Util qw/blessed/; BEGIN { $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; $ENV{PERL_LWP_USER_HTTP_10} ||= 1; } my $client = RPC::XML::Client->new("http://localhost/xml/index.php"); my $req = RPC::XML::request->new("hello"); say $req->as_string(); my $response = $client->send_request($req); use Data::Dumper; say Dumper($response);
Subject: index.php
Download index.php
text/php 1k
<?php ###################### No user serviceable parts below ##################### # # The XMLRPC server object # $xmlrpc_server = xmlrpc_server_create(); xmlrpc_server_register_method($xmlrpc_server, "hello", "hello"); function hello($method_name, $params, $app_data) { $response_xml = xmlrpc_encode(array('success' => true, '2' => '3')); header("Content-type: text/xml"); echo $response_xml; return ""; } xmlrpc_server_register_method($xmlrpc_server, "reverse", "reverse"); function reverse($method_name, $params, $app_data) { $request = $params[0]; $result = ''; if (isset($request['string'])) { $result = strrev($request['string']); } $response_xml = xmlrpc_encode(array('success' => true, 'result' => $result)); header("Content-type: text/xml"); echo $response_xml; return ""; } # # Process XMLRPC request # $request_xml = $HTTP_RAW_POST_DATA; error_log($request_xml); xmlrpc_server_call_method($xmlrpc_server, $request_xml, ''); xmlrpc_server_destroy($xmlrpc_server); ?>
Subject: send.php
Download send.php
text/php 82b
<?php $request = xmlrpc_encode_request("hello", array()); print "\n$request\n";
Download (untitled) / with headers
text/plain 1.3k
On Wed Dec 03 06:17:36 2014, lloy0076@adam.com.au wrote: Show quoted text
> > When using the attached client.pl to call the "hello" method on > "index.php" (running under PHP 5.5.14) I get: > > $VAR1 = 'RPC::XML::Client::send_request: parse-level error: End-of- > parse error: No error, methodCall or methodResponse detected'; > > ...as the response. > > This XML-RPC server, though, responds correctly to another XML-RPC > client written with the Nwc XML RPC Client in C#. > > Here is a sample output: > > [Wed Dec 03 21:40:50.552289 2014] [:error] [pid 908] [client > 127.0.0.1:49916] <?xml version="1.0" encoding="us- > ascii"?><methodCall><methodName>hello</methodName><params></params></methodCall> > [Wed Dec 03 21:42:55.918132 2014] [:error] [pid 1205] [client > 127.0.0.1:49928] <?xml version="1.0" encoding="utf- > 8"?><methodCall><methodName>hello</methodName><params><param><value><struct > /></value></param></params></methodCall> > > The first one, encoding in us-ascii is RPC::XML and it gets a response > it cannot understand. The second one is generated by C# / Nwc classes.
Interesting-- the C# request includes an empty struct in the request, whereas the Perl request (mine) does not. I wonder if that is related to the parsing problem. I'll look into this. Randy -- Randy J. Ray rjray@blackperl.com randy.j.ray@gmail.com
From: lloy0076 [...] adam.com.au
Download (untitled) / with headers
text/plain 189b
I decided to see if Python 2.7's xmlrpclib would work; here's the XML it produced: <?xml version='1.0'?>\n<methodCall>\n<methodName>hello</methodName>\n<params>\n</params>\n</methodCall>\n
Subject: python-client.py
Download python-client.py
text/x-python-script 132b
import xmlrpclib proxy = xmlrpclib.ServerProxy("http://localhost:80/xml/index.php"); result = proxy.hello(); print "%s" % result


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.