A cheap solution to a developer’s multi monitor lust OpenRasta – a really ReSTful alternative to WCF

I’ve been wanting to work with WCF for a fairly long time. I suppose I could have flirted with burnout and done it on top of my daily paying activities, but I like to think my health’s improved with not doing this kind of thing. In any case, suddenly a paying client has a requirement for a REST-based set of services, and I thought it’d be nice to try this with WCF for a couple of reasons:

  1. I always liked REST (die, SOAP, die) and have rolled my own more times than I’d care to mention
  2. WCF has an almost shiny, nearly-new REST Starter Kit

I’ve seen enough about WCF to know that I like the separation of contract from implementation and I thought I’d be able to get a good idea of whether it did enough of the following to make the effort invested in a “starter kit” with no go-live license worthwhile: -

  • Authorization / API key implementation (check – one sample project has an interceptor-based solution)
  • Serialization to XML and JSON (check – it’s baked right into the kit when you implement a collection service base)
  • Error handling and presentation (half a check – nice and RESTful, with a nice WebProtocolException that lets you tailor what just happened to the most appropriate HTTP status code, but I would like more control over what gets rendered back)
  • Documentation/discoverability (half a check – there’s a nice .../help URL based on standard WCF contract/member attributes but there’s no WADL. Did we need it anyway?)
  • General syndication support (check, thank you SyndicationItem)

In any case it all looks terribly promising. The templates are good, the screencasts are good … hang on, wait – Aaron Skonnard’s screencasts are mucking about with a Service.svc.base.cs file I don’t have, and that’s how he’s customising the output XML. That’s not in Preview 2. Suddenly I find that this stuff’s moved into Microsoft.ServiceModel.Web and I can’t edit it any more. So the customisation story must have moved. Then I discover that the way to customise is apparently to move the source code into your project and change the namespace so it doesn’t conflict with the existing ServiceModel. Woah. That’s not even as nice an “extensibility point” as we had in Preview 1… oh well. So I’m stuck with ItemInfoList and ItemInfo in my output XML. Suddenly the lack of the aforementioned go-live license doesn’t seem so bad. I wouldn’t be able to use this as it is now.

So this leaves me in quite an odd place – clamouring for half of a very promising toolkit that just isn’t quite finished and which I wouldn’t be legally allowed to use anyway. However, the source code appears to be all there. And we need a REST strategy really soon. Not to denigrate the excellent effort from the MS REST team, but it’s at times like this you wish the effort you’d just put in had been directed at an open source project – at least you’d have somewhere to go, even if you had to pedal that last mile yourself. I’ve been titillated and subsequently frustrated – I’m not allowed to touch, as the chaperone’s an army of lawyers.

Looks like I’ll be rolling my own again.

EDIT: Hmm, I might have been a bit hasty – there’s plenty in WCF 3.5 as it stands to build REST services. Just not quite as easily. I’ll miss WebProtocolException and I’ll miss having the zero-config approach. I might also miss the interceptor-based auth and the in-built help generation. But it’s still doable, if just somewhat harder…

Leave a Reply



© 2014 ZephyrBlog Suffusion theme by Sayontan Sinha