Bug #5149 [NEW]: XML-RPC sample bug
| From: | progman at ua dot fm | Date: | Thu, 18 Aug 2005 22:19:05 +0000 |
| Subject: | Bug #5149 [NEW]: XML-RPC sample bug | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-6680@lists.php.net to get a copy of this message | ||
From: progman at ua dot fm
Operating system: Win2k
PHP version: 4.3.5
Package: Documentation
Bug Type: Bug
Bug description: XML-RPC sample bug
Description:
------------
Examples taken here :
http://pear.php.net/manual/en/package.webservices.xml-rpc.examples.php
Client : Client.php
<code><?
ini_set("include_path", 'D:\Program Files\XML_RPC\;'.
ini_get("include_path"));
require_once 'RPC.php';
$input = 8;
$params = array(new XML_RPC_Value($input, 'int'));
$msg = new XML_RPC_Message('times2', $params);
$cli = new XML_RPC_Client('xmlrpc.php', '');
$resp = $cli->send($msg);
if (!$resp) {
echo '>Communication error: ' . $cli->errstr ;
exit;
// HERE THE BRAKES BUT WHY ???
}
if (!$resp->faultCode()) {
$val = $resp->value();
echo $input . ' times 2 is ' . $val->scalarval();
} else {
/*
* Display problems that have been gracefully cought and
* reported by the xmlrpc.php script.
*/
echo 'Fault Code: ' . $resp->faultCode() . "\n";
echo 'Fault Reason: ' . $resp->faultString() . "\n";
}
?>
</code>
Server : xmlrpc.php
<code><?
ini_set("include_path", 'D:\Program Files\XML_RPC\;'.
ini_get("include_path"));
require_once 'Server.php';
function returnTimes2($params) {
$param = $params->getParam(0);
// This error checking syntax was added in Release 1.3.0
if (!XML_RPC_Value::isValue($param)) {
return $param;
}
$val = new XML_RPC_Value($param->scalarval() * 2, 'int');
return new XML_RPC_Response($val);
}
$server = new XML_RPC_Server(
array(
'times2' =>
array(
'function' => 'returnTimes2'
)
)
);
?>
</code>
But when i run client.php it generates :
<b>Communication error : Operation successfull</b>
Whithout any retrieved code from server ...
But Why ?
Expected result:
----------------
NA
Actual result:
--------------
communication error : operation successful
At all - and any valid answers from server ...
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=5149&edit=1
--