|
Posted by Ming on 05/16/07 17:02
I am new to php5 programming :)
I redirect users to another server to login. After they login
successfully, they will be redirected to test.php. The server provides
xml_rpc interface so I can communicate with it. After running my
scripts, I get this error:
Fatal error: Call to undefined method XML_RPC_Response::kindOf() in /
usr/share/PEAR/XML/RPC.php on line 1972
It seems it is these two lines that cause problems:
I do get some response from the server, though.
The followings are my scripts:
test.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
include("cwl.php");
$test=new cwl();
$test->test();
?>
cwl.php
<?php
require 'XML/RPC.php';
error_reporting(E_ALL);
ini_set('display_errors', true);
class cwl{
private $cwlURL;
private $xmlrpcPath;
private $appID;
private $appIDPassword;
private $cwlClient;
private $sessionTicket;
private $params;
function __construct()
{
$this->appID='xxx';
$this->appIDPassword='xxx';
$this->xmlrpcPath='/path';
$this->cwlURL='someurl;
$this->sessionTicket=$_GET['ticket'];
$this->params=array( new XML_RPC_Value($this->sessionTicket,
'string'));
$this->cwlClient=$this->getCWLClient();
}
private function getCWLClient()
{
$client=new XML_RPC_Client($this->xmlrpcPath, $this->cwlURL);
$client->setCredentials ($this->appID, $this->appIDPassword);
$client->setDebug(1);
return $client;
}
protected function makeCall($functionName)
{
$functionName='session.'.$functionName;
try
{
$msg = new XML_RPC_Message($functionName, $this->params);
$resp= new XML_RPC_Response(new XML_RPC_Value());
$resp= $this->cwlClient->send($msg);
return $resp;
}
catch (Exception $e)
{
$e->__toString();
}
}
public function test()
{
$val =new XML_RPC_Value();
$val = $this->makeCall('getIdentities');
//***************************
//It seems it the line below causes the problem
$data = XML_RPC_decode($val);
echo "<br>";
if (isset($data['student_number']))
echo $data['student_number']."<br>";
else echo "Not a student<br>";
if (isset($data['employee_number']))
echo $data['employee_number']."<br>";
else echo "Not an employee<br>";
}
}
?>
Any advice? Thanks,
[Back to original message]
|