« Return to Thread: Our REST implementation
-- Matthew Ratzloff <matt@...> wrote
(on Saturday, 05 January 2008, 12:58 PM -0800):>Matt -- this is a comment I've made myself a number of times.
> This morning I looked at Zend_Rest for the first time and was surprised to
> see just how un-RESTful it is! I looked at the mailing list archives to see
> if I could find any design discussion and found this thread, so I'm
> resurrecting it to get other people's opinions.
>
> The component really is more RPC than REST, I think. And since these two
> concepts are basically diametrically opposed, it seems like the "Zend_Rest"
> name is misleading. Furthermore, while comparing this to Zend_XmlRpc I
> didn't see much in the way of substantive differences.
>
> Without intending to sound harsh, what is the niche that this component
> fills that wouldn't be more appropriately solved with XML-RPC or a fully
> REST-compliant architecture?
Unfortunately, at the time that I was helping out with tests and
documentation, I wasn't as up-to-speed on REST as I am now, and didn't
ask these important questions of the original author before it made its
way into the incubator.
Honestly, probably the best way to serve a REST app using ZF is using
the MVC (thought the original author of Zend_Rest was vehemently opposed
to doing so), and with the ContextSwitch action helper that's being
introduced as part of the AjaxContext action helper proposal, this
should be pretty trivial to accomplish.
(That proposal is at http://framework.zend.com/wiki/x/R6I , and code is
in the laboratory under the Zend_Form area.)
Now, all this said, I'll put on my devil's advocate hat, and state that
I know some feel that REST does not need to be RESTful, that the
important thing is that it simply uses HTTP for the transport. If you
look at many of the so-called REST APIs out there, it's pretty suprising
how many *don't* use XML in favor of arbitrary formats, and how many
don't necessarily follow the GET/PUT/POST/DELETE paradigms of REST nor
the idea of a URL as a resource. I personally like the idea of RESTful
resources, but many see this as merely a suggestion.
Either way... ZF will now be able to easily support either one.--> > methods) to be executed on each resource. In the web services world,
> Shahar Evron wrote:
> >
> > I am not an expert on the subject, but I think the key difference
> > between REST and RPC based web services is more philosophical:
> >
> > RPC (Remote Procedure Call), as the name suggests, is procedure focused,
> > as SOAP and XMLRPC are. In practice, an RPC web serivce will usually
> > present numerous procedures (or methods) than can be executed on a
> > single resource (URL).
> >
> > REST (Representational State Transfer) on the other hand focuses on
> > resources ("nouns") and allows several methods (usually CRUD like
> > that would usually mean you have numerous resources (URLs, "nouns"), and
> > you can execute a limited number of "methods" ("verbs") on each one
> > (HTTP GET, PUT, POST, DELETE == CRUD).
> >
> > A service which, for example, allows a user to retrieve, add, update and
> > delete articles in a blog, would be designed this way:
> >> > some kind of subclass of some Zend_Controller modules - it looks like
> > RPC:
> > POST http://example.com/blog/soap/articleManager.php
> > (Call the same URL, while the SOAP request body defines the method and
> > parameters)
> >
> > REST:
> > GET http://example.com/blog/rest/articles - get list of all articles
> > PUT http://example.com/blog/rest/articles - create a new article
> > GET http://example.com/blog/rest/articles/1 - retrieve article #1
> > POST http://example.com/blog/rest/articles/1 - update article #1
> > DELETE http://example.com/blog/rest/articles/1 - delete article #1
> >
> > and so on. One might simply say that REST takes a different approach to
> > mapping URLs to objects / methods / parameters, but I guess that under
> > some circumstances there is more than that.
> >
> > There is something very appealing for HTTP freaks in REST I think
> > because of the proper use of request methods (GET is never state
> > changing while POST is, etc.).
> >
> > As I mentioned briefly earlier, I think it would be quite easy to
> > implement a Rest_Server component (even if we name it differently) as
> > the REST URL to object / method / parameter mapping can be done quite
> > easily with some smart Zend_Controller routing / dispatching rules or
> > plug-ins.
> >
> > Shahar.
> >
> >
> > On Tue, 2007-05-29 at 15:55 +0200, till wrote:
> >> Shahar,
> >>
> >> On 5/28/07, Shahar Evorn < shahar.e@...> wrote:
> >> > I did some more reading on this and it really does seem that our
> >> > Rest_Server is more RPC oriented (eg. method focused and not resource
> >> > focused) web service implementation.
> >>
> >> I had this discussion with a friend a while ago. I am not sure where
> >> we left of - so can you provide an example where REST is less RPC and
> >> more like ... whatever it is supposed to be? ;-))
> >>
> >>
> >> Cheers,
> >> Till
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Our-REST-implementation-tp10834932s16154p14638961.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>
Matthew Weier O'Phinney
PHP Developer | matthew@...
Zend - The PHP Company | http://www.zend.com/
« Return to Thread: Our REST implementation
| Free embeddable forum powered by Nabble | Forum Help |