As far as I can tell REST is a methodology or an archecture. Is it a real tangable thing? I mean, can you look at a back-end code and determine if it is REST or not REST? How do you communicate with a WCF RESTful service? Are all WCF services RESTful?
REST AND WCF
Started by athono, Jul 16 2012 12:38 AM
1 reply to this topic
Sponsor:
#2 Members - Reputation: 922
Posted 16 July 2012 - 03:15 PM
Yes, REST is a tangible thing with a definition. That definition has been stretched by various web service makers all wanting to give themselves the "we do REST" badge, however. I really like Boris Lublinsky attempt to reign in the chaos this has created. He defined 3 levels of REST support: Three Levels of the REST Maturity Model.
You can see if a WCF service is restful either by figuring out in which form requests are passed to the service. See my descriptions above, if they use friendly URLs, respond differently to HTTP verbs and return full URLs to the web service it's REST.
In case you are pondering to write a RESTful web service in .NET, I would recommend ServiceStack instead.
- Level 1 means your service uses meaningful URLs to access and update resources. WCF can do that via the UriTemplate parameter in its WebGetAttribue and WebInvokeAttribute. For example, http://example.com/item/123 instead of http://example.com/myservice.svc [+parameters in SOAP message sent via POST].
- Level 2 means you make proper use of HTTP verbs (whenever you load a page, your browsers uses HTTP GET, but HTTP has more commands: PUT, DELETE, POST). WCF can do that, too, with some effort and you may need to tweak your IIS configuration to forward these HTTP verbs to WCF correctly (so HTTP GET http://www.example.com/item/123 would send you item 123. HTTP DELETE http://www.example.com/item123 would delete item 123)
- Level 3 means that resources returned by a web service are self-contained. The client will not need to concatenate strings and use special knowledge to build a URL for performs a specific command. So the data returned by HTTP GET http://www.example.com/item would contain the complete urls you would use to view each item in the list instead of just the item ids.
You can see if a WCF service is restful either by figuring out in which form requests are passed to the service. See my descriptions above, if they use friendly URLs, respond differently to HTTP verbs and return full URLs to the web service it's REST.
In case you are pondering to write a RESTful web service in .NET, I would recommend ServiceStack instead.
Professional C++ and .NET developer trying to break into indie game development.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.
Follow my progress: http://blog.nuclex-games.com/ or Twitter - Topics: Ogre3D, Blender, game architecture tips & code snippets.






