XMLRPC stuff
| From: | Wolfram Kriesing | Date: | Wed, 31 Oct 2001 22:05:07 +0000 |
| Subject: | XMLRPC stuff | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-2493@lists.php.net to get a copy of this message | ||
inspired by Stig's post, about the pear sub command communicating via
xmlrpc
(http://marc.theaimsgroup.com/?l=pear-dev&m=100430557325059&w=2)
i started fooling around with it too,
when i saw there is the same API already converted to PEAR i just
switched right to this
and I found out the following
1.
i think it would be nice if the XML_RPC_Response::getval() would
do a settype before returning the value, so the value is of the right
type, so you can also do those (nasty but sometimes necessary) checks
using ===
i came across that when checking a boolean for ===true, it was ==true
but the value was still an integer that's why === didnt work
what are the opinions?
2.
XML_RPC_Server::verifySignature
error return doesnt work properly, sorry but i havent found out why,
yet
Wanted ${wanted}, got ${got} at param ${pno})
always returns
Wanted , got at param )
examples
-----------
on how to use XML_RPC can be found at
http://wolfram.kriesing.de/pear/examples/XML_RPC/
try xmlrpx.php if you get "Hi AuthxLogin" than it worked :-)
much to see ha? but it gets it via XMLRPC
bugs
-----
in XML_RPC/Server.php (i guess the require is no bug, just my fault,
right?)
----------------------------------------------------------------
--- Server.php Wed Oct 31 22:54:01 2001
+++ myServer.php Wed Oct 31 12:46:11 2001
@@ -23,7 +23,7 @@
// XML RPC Server class
// requires: xmlrpc.inc
-require_once "XML/RPC.php";
+require_once "XML_RPC/RPC.php";
// listMethods: either a string, or nothing
$GLOBALS['XML_RPC_Server_listMethods_sig']=
@@ -300,7 +300,7 @@
// a debugging routine: just echos back the input
// packet as a string value
- $r=new XML_RPC_Response;
+ $r=new XML_RPC_Response(0);
$r->xv=new XML_RPC_Value( "'Aha said I: '" . $HTTP_RAW_POST_DATA,
"string");
print $r->serialize();
}
----------------------------------------------------------------
the first bug was the reason why my booleans were not returned
properly, the XML-response was correct, but the translation to a php
value didnt work, it was always 0, it works with this fix, but i dont
know if that is really the right place to fix the bug
the second
i guess it was meant to return the PEAR_Error ... right?
----------------------------------------------------------------
--- RPC.php Wed Oct 31 22:53:59 2001
+++ myRPC.php Wed Oct 31 21:52:19 2001
@@ -229,6 +229,7 @@
$XML_RPC_xh[$parser]['ac']="true";
else
$XML_RPC_xh[$parser]['ac']="false";
+ $XML_RPC_xh[$parser]['st'].=$XML_RPC_xh[$parser]['ac'];
$XML_RPC_xh[$parser]['vt']=strtolower($name);
// Drop through intentionally.
@@ -471,10 +472,10 @@
}
if(!$fp && $this->proxy) {
- PEAR::raiseError("Connection to proxy server
".$this->proxy.":".$this->proxy_port." failed");
+ return PEAR::raiseError("Connection to proxy server
".$this->proxy.":".$this->proxy_port." failed");
}
else if(!$fp) {
- PEAR::raiseError("Connection to RPC server
".$this->server."
failed");
+ return PEAR::raiseError("Connection to RPC server
".$this->server."
failed");
}
--
Wolfram