Using WCF for REST, Part 1
Just because you can do something doesn’t mean it’s a good idea.
We decided to use the Windows Communication Foundation to drive our REST-based web service. In hindsight, it was a poor choice. REST support in WCF seems like it was a last-minute addition to .NET 3.5. You can certainly hack something together, but I’ve found few real-world examples on the Internet, and most of those sidestep the tricky issues.
Here’s the short of it: WCF was designed for RPC-SOAP. More importantly, it was designed to SOA-enable legacy services that used older communications channels like DCOM. If you’re starting from scratch, and have full control over the output of your web service and the design of your object model, I’d recommend using a different (and simpler) framework.
We’ve gotten a good bit of blog traffic from people looking for help with Windows Communication Foundation and the REST architectural pattern. (It’s good to know that we’re not the only ones needing advice.) Here are the better sources we’ve found so far.
Windows Communication Foundation documentation on MSDN
Good overview presentation on REST and Syndication using WCF
Microsoft’s Picture Services Sample
Justin Smith’s WCF articles on Cybertopian Chronicles
Assorted posts on Rick Strahl’s blog
If you find other useful places to look, let us know!
Alex Henderson said,
Wrote on May 2, 2008 @ 12:40 am
I found the RestChess example from Mix this year a great resource for actually building a Restful API with WCF that handles OAuth / HiLo etc. (i.e. the trickier aspects)
http://sessions.visitmix.com/?selectedSearch=T01
http://www.restchess.com/
Found your article on “WCF, WebHttp Binding, and Authentication” particularly handy, that little tid bit isn’t well documented elsewhere.
Vish said,
Wrote on May 10, 2008 @ 9:38 pm
Hi
I work on the WCF team in Microsoft and would love to know of the areas we could improve the framework to support REST.
It would be fantastic if you could send me a mail describing the pain points and the areas we could improve.
Thanks!
Vish
Dean said,
Wrote on May 12, 2008 @ 2:48 pm
I’ll do that, Vish. I think most of my trouble stems from not having a solid background in the Indigo technology. I think of REST as the “simple case” for web services, while WCF views the WS-* stack as the default scenario. I’ll document my thoughts here and send you a copy as well.
Using WCF for REST, Part 2 « Infovark Underground said,
Wrote on May 17, 2008 @ 6:16 pm
[...] part one of this series, I listed several websites and blogs that had useful information on the Window [...]
Rinsing the SOAP from WCF (or, RESTful WCF Hyperlink Acupuncture) | The Freak Parade said,
Wrote on August 28, 2008 @ 10:43 pm
[...] Using WCF for REST, Part 1, Part2 and Part 3. Make sure you read all the comments though, several of the gripes brought up in these posts have been addressed with SP1. [...]