2008年7月30日星期三

Re: [fw-webservices] Zend_Rest_Server and Zend_Rest_Client error

Please do not cross post -- or, if you do, do so using CC.

I've answered this on fw-general already.

-- Adler Medrado <adlermedrado@gmail.com> wrote
(on Wednesday, 30 July 2008, 10:12 AM -0300):
> Hello All.
>
> I am trying to create a Zend_Rest_Server but it is not working and always
> return a response like that:
> <rest generator="zend" version="1.0">
> <response>
> <message>An unknown error occured. Please try again.</message>
> </response>
> <status>failed</status>
> </rest>
>
> Does anyone have some example? i think i am doing someting wrong but i am
> following the Documentation and i do not know where i can look for other
> tutorial/ code example.
>
> Below follow the sources:
> Server:
> public function indexAction()
> {
>
> $this->_helper->viewRenderer->
> setNoRender();
> $this->_helper->layout->disableLayout();
>
> $server = new Zend_Rest_Server();
> $server->setClass('Example');
> $server->handle();
>
> }
>
>
> Client:
> public function clientAction()
> {
> $this->_helper->viewRenderer->setNoRender();
> $this->_helper->layout->disableLayout();
>
> $client = new Zend_Rest_Client('http://localhost/form/index/index');
> echo $client->hello('adler')->delete();
> }
>
> Example class:
> class Example {
> public function hello($nome)
> {
> return "Hello $nome";
> }
>
> }
>
>
> --
> adler medrado
>
> Consultor
> Zend Certified Engineer #ZEND003922
> http://www.adlermedrado.com.br

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: