Problems with Zend_Rest_Route

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

Problems with Zend_Rest_Route

Esdras Beleza
Hi folks,


I'm new to Zend Framework and I'm trying to follow the documentation and
create a REST web service using Zend Framework 1.11.

I did the following steps:

1) Created a project using zf create project MyProject
2) Created a controller using zf create controller MyWebService
3) Made MyWebServiceController inherit Zend_Controller_Action and created
the methods {index,get,post,put,delete}Action and made them print some
message using

    public function getAction()
    {
$this->getResponse()
             ->setHttpResponseCode(200)
             ->appendBody('getAction has been called.');
    }

(the same code for each method)

4) Now I need to make my URL direct to the service using some kind of "
http://localhost/rest/" using Zend_Rest_Route, I tried to follow some
instructions from docs, tutorials, blogs etc. but without success.

Can anybody help me?

Thanks in advance,


Esdras

--
http://www.esdrasbeleza.com
Reply | Threaded
Open this post in threaded view
|

Re: Problems with Zend_Rest_Route

Wil Moore III
This post was updated on .
Esdras Beleza wrote
3) Made MyWebServiceController inherit Zend_Controller_Action and created
Hi, looks like you just need MyWebServiceController to extend Zend_Rest_Controller instead.

class MyWebServiceController extends Zend_Rest_Controller {}

You will also need to setup a route:
SEE: http://framework.zend.com/manual/en/zend.controller.router.html#zend.rest.route_config
--
Wil Moore III

Best Practices for Working with Open-Source Developers
http://www.faqs.org/docs/artu/ch19s02.html

Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html

DO NOT TOP-POST and DO trim your replies:
http://linux.sgms-centre.com/misc/netiquette.php#toppost