Bug #5149 [Opn->Bgs]: XML-RPC sample bug
| From: | Unknown Sender | Date: | Fri, 09 Sep 2005 19:48:56 +0000 |
| Subject: | Bug #5149 [Opn->Bgs]: XML-RPC sample bug | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-6777@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=5149&edit=1
ID: 5149
Updated by: @php.net
Reported By: progman at ua dot fm
-Status: Open
+Status: Bogus
Id: 5149
Type: Bug
Package: Documentation
Operating System: Win2k
PHP Version: 4.3.5
New Comment:
Your example is wrong. You must provide the hostname where xmlrpc.php
is available as the second parameter to the constructor of
XML_RPC_Client.
Previous Comments:
------------------------------------------------------------------------
[2005-08-18 18:19:05] progman at ua dot fm
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 this bug report at http://pear.php.net/bugs/bug.php?id=5149&edit=1