Multiple calls from Zend_Rest_Client to service

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple calls from Zend_Rest_Client to service

meloen
Hi I want to use the same Zend_Rest_Client to do multiple calls to the
same web service but with different methods.

In version 1.6.2 I was able to do this. But in version 1.7 The second
call just returns the result of the first call.

Do I always have to create a new client? Or can I reset it's state. It's
not clear from the reference guide.

Thanks, Meloen

Reply | Threaded
Open this post in threaded view
|

Re: Multiple calls from Zend_Rest_Client to service

meloen
On Sun, 07 Dec 2008 00:21:24 +0000, meloen wrote:

> Hi I want to use the same Zend_Rest_Client to do multiple calls to the
> same web service but with different methods.
>
> In version 1.6.2 I was able to do this. But in version 1.7 The second
> call just returns the result of the first call.
>
> Do I always have to create a new client? Or can I reset it's state. It's
> not clear from the reference guide.
>
> Thanks, Meloen

The following calls return the same result:

<?php
require_once('Zend/Rest/Client.php');
$client = new Zend_Rest_Client("http://localhost/service.php");

$moo = $client->getMoo(66)->get();
print_r($moo);

$moo = $client->getBlah(88)->get();
print_r($moo);
?>

These calls do work, but behaviour is different with Zend framework 1.6.2:
$moo = $client->getMoo()->testid(44)->get();
print_r($moo);

$moo = $client->getBlah()->testid(55)->get();
print_r($moo);


service.php:
<?php
$server = new Zend_Rest_Server();
$server->setClass('Blah');
$server->handle();

class Blah
{
  function getBlah($testid)
  {
    return 'Blah';
  }
       
  function getMoo($testid)
  {
    return 'moo';
  }
}
?>