views:

127

answers:

3

So, what do the experts recommend? WCF Rest Toolkit? ADO.NET (now WCF) Data Services AKA Astoria? Hand rolling it using ASP.NET MVC? Other?

Requirements are fairly vanilla: HTTP GET/POST for a small number of resource types, XML and JSON output, needs to live in the same appdomain with a SOAP ASMX web service.

My criteria are:

A) performance

B) development complexity (including the learning curve)

C) maintainability

Thanks!

+2  A: 

If you already have your data in a structured form in a database like SQL Server, and you want to expose those bits of data (e.g. your customers, their orders etc.), then the WCF Data Services is probably one of the most efficient and productive ways to expose your data. It handles a lot of the underlying goo for you and lets you concentrate on what you want to expose, and what to hide. And it even supports things like querying in the query strings, and inserts and updates quite easily.

If you have more non-structured data, both bare-bones WCF with the REST starter kit or ASP.NET MVC seem to be quite valuable choices. Haven't done much myself with either of the two, but both are quite current, quite productive for developers and should fit nicely in your environment.

So I guess in your position, I'd check out WCF Data Services first and use it, if it fits the bill - and if not, choose between WCF REST Starter Kit (which also works with classic ASP.NET webforms, or winforms, or console apps, or WPF, or Silverlight) - or check out ASP.NET MVC if you're going that way already in your project.

marc_s
+4  A: 

The best framework for REST services I have seen is OpenRasta, which is built from the ground-up to enable REST simply. http://trac.caffeine-it.com/openrasta

Building RESTful services with OpenRasta is much simpler than with WCF in my experience. This is also then reflected in the ease of maintenance. I haven't tested performance, but have never noticed it to suffer in this area, and because of the clean architecture I would not be surprised if it were quicker.

Some other links for you:

http://codebetter.com/blogs/kyle.baley/archive/2009/04/19/openrasta-or-how-to-speak-rest.aspx http://blog.huddle.net/we-love-openrasta http://www.vimeo.com/3385419

I haven't used the Data Services, but from what I've read I don't think they count as truly RESTful, but they may meet your requirements. I don't know.

Neil
A: 

If you use the .NET 4 framework REST has much better support using RouteHandlers. If you are looking to implement on earlier versions, I would just implement your own HTTP handler and use IIS6 wildcard routing (aspnet_isapi.dll) to process your requests.

With the REST starter kit you are limited to having a .svc file, but if you implement your own handler you can parse the requests manually and have much more granular control over the restful service. There is some additional complexity but its mostly around deployment.

Berkshire
This answer is equivalent to telling people ti reimplement the TCP stack if they want to control the naggle algorithm using winsocks.Implementing your own IHttpHandler is way too low level to be useful in all but the simplest situations.
serialseb
I respectfully disagree. I don't see how that comparison works at all. A custom handler is not very low level, it still runs on top of IIS. Have you even done it before or are you afraid to leave the WCF REST Starter kit?.NET4 WCF REST is built on top of RouteHandlers just as I have described my implementation. Microsoft seems to think its a good idea.
Berkshire
Dude. Drop the attitude. I built OpenRasta, I know a thing or two about building stuff on top of IHttpHandler.Microsoft seems to think a lot of things are a good idea that make me wake up in the middle of the night in horror, that doesn't make it good.So to be exact, dealing with HttpContext to do content negotiation, uri parsing, controller / handler execution, binding, and all the other things a good framework provides you *is* too low level to be productive, unless your requirements are to build a hello world app.
serialseb
serialseb:You are completely wrong. I was able to implement fully functional REST service in about 20 hours, using IHttpHandler. If you think that it is to low level to be productive, that is based on your understanding of it (That is relative). In our case this was the best option, it gave us flexibility, we were able to implement MORE than Microsoft provides in their standard starter kit or in WCF (more support/extensibility for serialization, compression, and full HTTP spec) and all in that small amount of time. Don't mislead readers when you obviously don't understand how easy it could be.
Phobis