PEAR::XML_RPC
| From: | Tony Bibbs | Date: | Wed, 09 Jul 2003 19:19:20 +0000 |
| Subject: | PEAR::XML_RPC | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6547@lists.php.net to get a copy of this message | ||
I'm trying to learn and use PEAR::XML_RPC. I was able to get a client to hook-up to one of the userland services just fine. Now I'm writing a very simple custom xmlrpc server. I can't seem to get the server to pass the request to the appropriate function. Here is what I have:
require_once 'XML/RPC/Server.php';
function XMLRPC_Handler($params) {
XML_RPC_Server_debugmsg('here now');
return new XML_RPC_Response(new XML_RPC_Value('Hello World', 'string'));
}
$XMLRPCServer = new XML_RPC_Server(array('AA.authenticate' => array('function' => 'XMLRPC_Handler')));
The fault I got is:
XML error: no element found at line 1
My client looks like this;
require_once 'XML/RPC.php';
$f=new XML_RPC_Message('AA.authenticate');
$c=new XML_RPC_Client('/A_and_A/service/XMLRPC_index.php5', 'localhost', 80);
$r=$c->send($f);
if ($r->faultCode()) {
print "Fault: \n";
print "Code: " . $r->faultCode() .
" \nReason '" .$r->faultString()."'<BR>";
exit;
}
$v=$r->value();
print $v->scalarval();
htmlentities($r->serialize());
What obviously simple thing am I missing?
--Tony