-- Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote
(on Thursday, 03 July 2008, 03:14 PM +0300):
> 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();
> }

First problem spotted. The above needs a docblock that minimally details
the return type:

    /**
     * Return current timestamp
     *
     * @return int
     */
    function theTime()
    {
        return time();
    }


> $server = new Zend_XmlRpc_Server();
> $server->addFunction('theTime');
> echo $server->handle();

Second, make sure you have display_errors off in your servers script:

    ini_set('display_errors', false);

This should be at the top of your script.

If you still have issues after making those changes, write back to the
list.

> -------------------------------------------------------------------
> 
> and the client in request controller :
> 
> -------------------------------------------------------------------
> require_once 'Zend/XmlRpc/Client.php';
> 
>         try{
>             $client = new Zend_XmlRpc_Client('http://me2resh/services/html/
> Index');
>        
>             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

-- 
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

Reply via email to