Saturday, September 12, 2009

WCF and REST

I'm on a project that was using WCF and we've managed to make the transition to using REST (well, to be honest so far its just POX).

REST is a joy and I really find it such a pleasant experience compared to RPC let alone WS-*.

However WCF and REST just are not good bed fellows. Some of the problems are that it doesn't support linking out of the box, content negotiation isn't there, no support for common HTTP/REST patterns, it limits the design/granularity of your resource handlers (think MVC controllers), and the REST starter kit (at least when I looked at it) was appalling.

There are also lots of annoyances that you only discover when you come to use it and unfortunately, as Seb discovered when he developed our REST framework on top of WCF, WCF lacks some key extension points meaning you end up having an extremely painful time getting the functionally you need.

The point of this post isn't to beat up on WCF, its just to make you aware of the issues. If all you want to be able to do is a bit of simple CRUD then you might find WCF to be a good solution, however just be aware that it isn't designed to scale out to handle more interesting problems or more RESTful solutions.

On the bright side the WCF team did contact me and Seb and we did give feedback which apparently will feed into a release post-WCF 4. My feeling is that if they don't make massive improvements then WCF will lose out on the REST battle, especially as there are some great REST frameworks appearing in .NET-land.

Share This - Digg It Save to del.icio.us Stumble It! Kick It DZone

1 comment:

  1. Anonymous2:57 pm

    Square peg round hole!

    As far as I can see after using WCF to do REST on a couple of projects is it produces 'a child only a mother could love...'

    We ended up rolling our own resource orientated RESTful framework that worked with POCOs without any communication infrastructure leaking into the domain (no attributes) etc...

    In future I to will be looking at any of the RESTful frameworks for .Net

    ReplyDelete