Thursday, February 3, 2011

Developing Rest Web Services using .NET WCF

There are a number of ways to create a rest web service in visual studio.

1)Convert an existing WCF soap web service into a WCF rest web service.

The following 15 minute video shows how easy it is to accomplish this.

2)Download Microsoft's WCF Rest Starter Kit from the following codeplex site:

A white paper on developing rest in WCF using the rest starter kit can be found here:

The starter kit contains various templates to speed up the process of creating services. The templates include an Atom Feed WCF Service, AtomPub WCF Service, HTTP Plain XML WCF Service, REST Collection WCF Service and a REST Singleton WCF Service.

3)Create a WCF Rest web service from scratch using a visual studio solution containing for example the following projects:-

ASP.NET Web Application project template - this project is used to create a rest service. It contains a service contract class with operation contracts and data contracts.

A Web Service template is also added to this project, this template is a visually designed class for creating a web service. This is where the implementation code for the operation contracts of the web service will be placed.

Windows Forms Application project template - used to host the rest web service. This project contains an app.config file and a code file with service host code.