In a previous post I highlighted a great webcast by Scott Hanselman on OData and discussed the metaphor he used to explain OO and SO (the Librarian Service). I’d like to continue discussing that webcast and this time turn my attention to REST and WS*.
To paraphrase Scott’s explanation,” SOAP is great for (that kind of) asynchronous message passing with the appropriate level of transactional consistency and so on, but if you just want to get a list of books and walk around in the stack of books, should I be sending asynchronous request-response messages to the Librarian Service? That’s rather heavy. I just want to see some stuff. I just want to do a “GET”. That’s what REST is all about.
REST says “We’ve got this thing called HTTP with a verb called GET and a cool addressing scheme in the URL that lets me get stuff (and we I have some other verbs like PUT, POST and DELETE that map really nicely to Create, Read, Update and Delete. So if I want to do CRUD over HTTP, the semantics are already there. So REST is about retrieving resources and sometimes about updating/modifying them.
So if we don’t get dogmatic and ‘exclusive’ about how we want to approach the system, we could now implement hybrid systems where for the CRUD , we could use WCF Data Services and OData and for the areas where we need the security , reliable messaging and to interoperate with legacy systems some of which may be using the WS* spec (for instance if we are passing money around ), then we use the ‘traditional’ SOAP approach. Most of the time we try to create artificial divisions and ring-fence our systems and tie them all to a particular approach when we really should be implementing services in a way that is appropriate for the parties/systems/people that are consuming them.
I think the final statement there is worth repeating : we should be designing/implementing services in a way that is appropriate for the scenario and consumer.
A lot of the proponents of REST (but of course not all of them) tend to be dogmatic. “WS* is evil” is the usual mantra. That’s simply not true. Sure, it is complex. Once you get past the WS-I basic profile (and even that is not implemented by everyone), things are hard. But complexity of SOAP does not negate the necessity for it nor is it an argument for a “programmable web”. What if I don’t want the web (or the part of it where my system lives) to be programmable? I want to expose services, but i want to choose the consumers and I mandate the contract. In, say a financial services domain, for example a Payments System, I certainly don’t want my customers details to be easily available over a “GET”. Heck, no! I want the appropriate headers, I want X.509 mutual certificates, I want the whole shooting match (otherwise my customer will shoot me ) . But if I were to build say, an admin interface, where my user base is locked down and heavily authenticated, and if there was a scenario where they needed to drill down to look at payment patterns, then sure, GET would be fine, saves me having to define numerous interfaces just to retrieve different aspects of the same thing.
Anyway, this isn’t intended to be a rant. I’m excited about the potential of WCF Data Services and OData. In the next post, we’ll examine one of the most interesting aspects of that webcast, namely a demo of a data service with absolutely no database which puts paid to the notion that WCF Data Services is about chucking your precious DB straight into the internet. Stay tuned.
I was recently watching an awesome webcast by Scott Hanselman on the topic of OData. Even if you are familiar with OData, I would recommend that webcast. The way he explains the position of REST and WS* is very balanced and educative. No dogmatic rants on how “rubbish” WS* is and how waay-cool (not) REST is. Anyway, more about the subject of that webcast in another post but what I wanted to highlight was this cool metaphor that Scott used when talking about OO and SO.
To paraphrase his illustration, “In the old days in the 90s we would model, say, a book as a “Book” object and that book object would have a “Checkout()” method and we would call “book.Checkout()” and we would sit back feeling satisfied with the “real world” approach. But then service orientation made us realize that there really is a Librarian Service and a Checkout Request and you submit the Checkout Request to the Librarian Service and it would go off and do that work asynchronously and you would “hang out” in the library and when it was ready it would call you back and give you the Book Checkout Response. This turns out to be a better metaphor for how life works.
IMO, this is a great explanation for the difference in approaches to system design. It’s still quite possible for these two to co-exist in scenarios where we design the “macro” system with SO and the internal components follow nice “OO” composition and/or hierarchies. The really cool part of SO is that it takes the “encapsulation” level much higher up. Consumers think in more coarse grained terms of message exchange patterns and about service levels rather than about methods on individual objects.
I’m Dad again for the second time . Baby Rachel arrived last week and is already alert and ready to take over the world. Just check out the picture.
Well, I guess that pretty much squeezes down my community project bandwidth down to a minimum. This is going to be a long project. Western parents usually get away with an 18-year gig but Indian ones don’t
Running the Experimental Instance from Command Line
Sometimes when running the experimental instance (for example when debugging a visual studio extension such as Feature Builder), the system throws error messages such as the error in following screenshot and asks us to run the application (that is, the experimental instance) on the command line with a “/log” parameter.
In order to run the experimental instance from the command line with the logging parameter, enter the following on a command prompt
|“C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe” /rootSuffix Exp /log|
This will then launch the instance and the log file will be populated. In general you are looking for information there that highlights if the extension clashes with another.
Completely resetting the Experimental Instance
In my case, while there were many ‘clashes’, it didn’t tell me what was specifically wrong. So, to fix this, I had to resort to Daniel Cazzulino’s post where he explains how to reset the experimental hive completely.
In case your Start menu doesn’t have a pinned option to “Reset the Experimental Hive” (mine didn’t), you can find it in the Start –> All Programs –> Visual Studio 2010 SDK –>Tools menu
Now when you launch the “rest Experimental hive” command line option, it will show the progress of initializing the experimental hive as shown in the screen below
As Daniel points out, when you first launch the experimental hive after that you need to manually enable the extensions in Extension Manager and after that it should work as normal.
One of the problems I had was that the experimental instance still had Feature Builder RC (0.9) installed so it refused to show me any of the new templates or my projects when debugging and this clean reset sorted the issue out.
Hope this helps if you run into issues with the experimental instance.
My first post for our MCS Solution Development Blog is now live and it’s on the topic of Feature Builder. This is the first in a series of posts in which we will go deep into the Feature Builder tooling and explore all that it offers for building Feature Extensions. I’ll link to the posts here on this blog but won’t cross post the same content, although i may post separate related content here.
Check it out and send me some feedback on the topics you’d like to see covered in this series. Also have a look at the ton of other great posts that my colleagues have been writing on everything from Azure to XAML (and all alphabets in between ).
I’ve taken my first foray into the world of producing videos with a set for MockingBird.
- Introduction : Getting up and running with MockingBird V2, using the Web Application and the Configurator Module.
- WCF Support : How the Console Host works to provide the WCF Support.
- Understanding MB Configuration: Digging a little deeper into the configuration files.
Take a look and let me know what you think of the quality and content (and also if these links all work for you. SkyDrive has been giving me some problems in sending links around). I will work on doing more videos if there is a demand for them. Looking forward to your feedback.
I’m delighted to announce that MockingBird v2 has finally hit the RTM milestone. Whew! That was a long RC !
So, what’s new in this release ?
- First off, there’s a brand new Service Configurator module which makes it dead simple to create a mock service. Just pick a WSDL, click through a couple of menu options and it generates a complete service with all the default settings. You can then edit the config (manually) if you want to tweak the behavior further. Watch this space for enhancements to the tooling.
- The Service Studio app (of which the Configurator module is a part) has been completely rewritten and the GUI now employs the (free) Krypton Windows Forms Control Toolkit. That is simply an awesome piece of software and the fact that its free is mindblowing. I’m no GUI expert so any help in this area is a plus. I think you’ll agree that the new UI is way better than the old. (What’s that? you dont like it ? Hmm, if you know WPF/Silverlight, how about helping me write a better one? ) . Studio now is a full fledged management application for the Simulator. Tr
- Configuration has been given a complete overhaul. The config system no longer expects all config files to be siblings of the system config, which frees up the app to have centralized configuration (shared by the console host and the web application). I have even got rid of the EntLib config gunk from the app.config and kept it totally separate. I’ll write about all that separately. The next step in this is to externalize the WCF service and client config (which I know how to do but just havent had time) so again, watch this space.
- Tracing has now been added in so you can launch DebugView and happily monitor whats going on in the system. So you dont really need the log files (although you can always choose to use Log4net or EntLib additionally).
- Multi-Part WSDL support in the Configurator and the Message Instance Builder (formerly called WSDL Browser). Thanks to some cool metadata parsing code that Alex put into WSCFBlue and kindly allowed me to copy out, the system can now handle WSDLs on file and from any live service endpoint.
- Installation And Configuration is now made pretty much single click (3 clicks – 1 for each host and 1 for the studio) with a Powershell script to give permissions.
- RollUp of some functionality that the team put into the code-base post RC such as XsltResponse (to dynamically generate a response by applying XSLT to the request), a Soap Header aware message handler and various other fixes. The handlers now come with a proper MessageHandlerBase class so if you want to extend MockingBird with your own handlers, you can simply inherit from that and write your specific code.
Things to watch out for
- WSDLs are generally a minefield, so i wont claim that MB can handle any metadata you throw at it. It will choke on some WSDLs (notably Amazon web services) but under the covers I’m using stuff like MetadataExchangeClient and WsdlImporter from the core .NET framework so there’s not a lot I can do to handle weird WSDL. Anyway, if this is an area that gives you grief, let me know and we’ll see if we can start to support custom ‘import extensions’ like svcutil.
- Windows 7, 2008+ and IIS7.x : Limited time = limited test surface. I extensively tested on Windows Server 2003 R2 but not on anything else although the team does use Win 7 and Windows 2008 when they code MB features. I have included some notes on troubleshooting in the guide. The number 1 area that you are likely to fall a victim to (in IIS 7.x) is that the AppPool running MockingBird should be in Classic mode.
So, what’s next ?
- Some time to sleep I hope (although with baby no. 2 due shortly, that’s not going to happen is it?
- REST support
- Azure anyone?
- More in the configurator GUI
Sound appealing ? think you can help (except with the sleep !!) ? Let me know.