Resources Over MVC – Introduction

October 31, 2011 20:51 by admin

Over the last couple of years I have been blogging about using writing a RESTful web service using ASP.Net MVC. I’ve decided to put this code onto CodePlex and publish it via NuGet. Over the next few days I’ll publish a number of posts in which I’ll take you through creating a basic web service using the Resources Over MVC (ROM) assembly.

I don’t want to prescriptive about what constitutes a RESTful web service, there are plenty of opinions out on the web regarding that matter. In fact I deliberately did not call the assembly Rest Over MVC to avoid the assumption that using this assembly would magically mean your web service was RESTful. For that you will need to do some reading around, design your resources and decide what you think constitutes a RESTful web service. Hopefully, over next few posts, I’ll show that the set of helper classes in this assembly are not too opinionated, but you should be able to use them to provide the following features:

  • Serve and receive multiple representations and encodings of resources
  • Support a constrained number of methods
  • Allow representations to include hyper links

Obviously as this approach is based on ASP.Net, it is providing a web service over the HTTP protocol, so it does make use of standard:

  • HTTP headers
  • HTTP methods
  • HTTP status codes

These are the posts that will lead you through how to implement your own web service:

  • Bare Minimum Part 1 – shows how you can reference the ROM assembly and with a single line of code be returning multiple representations to your clients
  • Bare Minimum Part 2 – adds another line of code to allow your web service receive multiple representations
  • A More Complex Sample – introduces a fuller web service example
  • Simple Clients Part 1 – shows how ROM can return different formats using a query string parameter
  • Simple Clients Part 2 – shows how ROM supports POST overloading via a custom header, form variable or by using a query string parameter
  • Providing Help – allowing client developers to get help from and to experiment with the web service directly in their browser.
  • Allowed Verbs – adding support for the Allow header
  • RESTful Routing – adds support for less capable clients
  • Add a Test Harness – allows your client developers to try out the web service from their browser
  • Custom Serialisation – different ways of getting your representations just right

Add comment

  Country flag

  • Comment
  • Preview