TechDays 2009: ‘Building REST-ful Services with WCF’ Follow-up

TechDays 2009I’m by no means a native REST-afarian: I was a Microsoftie during the time when SOAP and WS-* were all the rage, and the first version of WCF was released (all lathered up in SOAP) to unify communications in .NET.

But as I do more client-side development – particularly with Silverlight and ASP.NET AJAX – I’ve encountered more and more service scenarios where the REST architecture, and lightweight data formats like JSON, make a lot of sense.

So it’s a case of horses for courses, and very good news that the ultra-extensible WCF now has strong built-in support for both SOAP and REST… and JSON and ATOM/RSS syndication and more.

The verbs that make up the uniform REST-ful interface
The verbs that make up the uniform REST-ful interface

Get the REST Starter Kit

If you’re interested in WCF’s support for REST, please download the WCF REST Starter Kit, and check out the resources for REST in Windows Communication Foundation linked here.

Paste XML as Types
Paste XML as Types

The REST Starter Kit gives Visual Studio 2008 SP1 a lot of additional helpful functionality for consuming REST services from a client, including the “Paste XML as Types” functionality that got an audible “oooh!” today.

Here’s how it works: You copy some XML into your clipboard, and then use this menu item to paste it into your code as C# classes. Then, you can use the HttpClient classes (found in the Microsoft.Http and Microsoft.Http.Extensions assemblies, also part of the Starter Kit) to load your data into a client app without munging the XML. Very nice, and no “Add Service Reference” magic needed.

More on WCF+REST:

I am immensely indebted to Jon Flanders, a true REST-afarian, for the foundation of today’s presentation. He literally wrote the book on REST-ful .NET.

He’s presented on this subject at the past two TechEd conferences. You can watch his TechEd2009 presentation here and download that presentation’s sample code here.

Hope that helps, and happy service building!