Try the following:
In your controller put something like:
class XmlRpcController extends Zend_Controller_Action
{
/**
* Index
*
* @return void
*/
public function indexAction()
{
$this->_helper->viewRenderer->setNoRender();
$cacheFile = CACHE . DS . 'xmlrpc.cache';
$server = new Zend_XmlRpc_Server();
if (!Zend_XmlRpc_Server_Cache::get($cacheFile, $server)) {
$server->setClass('Time', 'time');
Zend_XmlRpc_Server_Cache::save($cacheFile, $server);
}
echo $server->handle();
//$getRequest = $server->getRequest()->saveXML();
//$getResponse = $server->handle()->saveXML();
//echo 'Request: ' . $getRequest;
//echo 'Response: ' . $getResponse;
}
}
Uncomment the last for lines for debugging.
Then in your library directory create a file called Time.php
class Time
{
/**
* Time
* @return int
*/
function getTime()
{
return $time();
}
}
You would then make an xmlrpc call to the method time.getTime
- Robert
________________________________
From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED]
Sent: 03 July 2008 13:42
To: Robert Castley
Subject: Re: [fw-general] XML-RPC startup
i added it and still getting the same error
here is how my code is now :
i am putting the server in the index controller :
-------------------------------------
require_once 'Zend/XmlRpc/Server.php';
/**
* @return int
*/
function theTime(){
return time();
}
$server = new Zend_XmlRpc_Server();
$server->addFunction('theTime');
echo $server->handle();
-------------------------------------------------------------------
and the client in request controller :
-------------------------------------------------------------------
require_once 'Zend/XmlRpc/Client.php';
try{
$client = new
Zend_XmlRpc_Client('http://me2resh/services/html/Index'
<http://me2resh/services/html/Index%27> );
echo $client->call('theTime');
}catch (Zend_XmlRpc_Client_FaultException $e){
echo $e->getMessage();
}
-------------------------------------------------------------------
when i do this i get the following error :
Failed to parse response
On Thu, Jul 3, 2008 at 3:26 PM, Robert Castley <[EMAIL PROTECTED]>
wrote:
You need to add phpdoc info about your function e.g.
/**
* Get time
* @return string
*/
________________________________
From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED]
Sent: 03 July 2008 13:15
To: [email protected]
Subject: [fw-general] XML-RPC startup
Hi all,
i am trying to make a simple web service using XML-RPC to return the
time stamp
i am putting the server in the index controller :
-------------------------------------------------------------------
require_once 'Zend/XmlRpc/Server.php';
function theTime(){
return time();
}
$server = new Zend_XmlRpc_Server();
$server->addFunction('theTime');
echo $server->handle();
-------------------------------------------------------------------
and the client in request controller :
-------------------------------------------------------------------
require_once 'Zend/XmlRpc/Client.php';
try{
$client = new
Zend_XmlRpc_Client('http://me2resh/services/html/Index'
<http://me2resh/services/html/Index%27> );
echo $client->call('theTime');
}catch (Zend_XmlRpc_Client_FaultException $e){
echo $e->getMessage();
}
-------------------------------------------------------------------
when i do this i get the following error :
Failed to parse response
what could be wrong here ?
--
Ahmed Abdel-Aliem
________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs
Email Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________
________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs
Email Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________
--
Ahmed Abdel-Aliem
________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________
________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________