LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   PHP xmlrpc problem. (http://www.linuxquestions.org/questions/programming-9/php-xmlrpc-problem-417601/)

Jim44 02-20-2006 12:14 PM

PHP xmlrpc problem.
 
I'm venturing into php, specifically xmlrpc and wrote what I thought was going to be the simplest client possible, but what it is telling me makes no sense.
Here's the code.

Quote:

<?php
include ('XML/RPC.php');


$client = new XML_RPC_CLIENT("/RPC2","localhost",8181);
$client->setDebug(1);
$str = new XML_RPC_Value("Test String ", "string");
$msg = new XML_RPC_Message("local.echo",array($str));
$response = $client->send($msg);
if (!$response->faultCode()) {
$value = $response->value();
echo $value;
} else {
print "Error code: " . $response->faultCode() . " Message: " . $response->faultString() . "\n";
}

?>
And here is the error output. "missing top level xmlrpc element"??? Sure looks like <methodResponse> to me.


Any ideas?


Quote:

---GOT---
HTTP/1.1 200 OK
Date: Sun, 19 Feb 2006 11:24:44 GMT
Server: libwww-perl-daemon/1.36
Content-Length: 130
Content-Type: text/xml

<?xml version="1.0"?>
<methodResponse>
<params>
<param><value><string>Echo: </string></value></param>
</params>
</methodResponse>

---END---

---PARSED---
NULL
---END---

Error code: 2 Message: Invalid return payload: enabling debugging to examine incoming payload missing top level xmlrpc element
This fails on two different systems, so I'm sure it's something I'm doing wrong.
The server works fine with a perl client, so I kind of think it's in this code somewhere.

Thanks,
Jim.


All times are GMT -5. The time now is 06:58 PM.