Saturday, April 22, 2006

Are WS-* specs too top down?

David Ing has a good post which essentially says that read-only operations are so common and so important that it is a good idea to treat them as a special case, which is what he claims GET does in the REST world.

It's a fair point but it seems to assume that the whole swathe of WS-* specs are necessary in all cases. If all you're doing is a straight query, you don't need WS-AtomicTransaction, WS-ReliableMessaging, WS-Notification or pretty much any of the other stuff. You just need to define what your request looks like, what you expect to get back (most often as a couple of XSDs) and describe how to ask the question. REST seems to do this by providing a URL which encodes the full identity of the resource being queried; WS-* does this by specifying the location of the server in one place and uses the concept of an 'operation' to specify the "question". There's not a great deal of difference at this level that I can see.

The biggest difference I see when perusing documentation is that the WS-* guys give you a WSDL and some XSDs and expect you to figure it out (or feed it to your tools). The REST guys give a nice example of what the XML flowing over the wire should look like. Sometimes that's *all* they give, which just scares me, but that's not a criticism of the entire approach - and the example that is often provided is fantastic.... it lowers the barrier to user experimentation significantly.

Where I think WS-* shows its value is when somebody then asks you to update the data you've just received or if you need to do it securely, for example. WS-* provides a way to call operations with side effects - and to do it in a security context, or transaction context, or whatever - using precisely the same model as the simple query. It's not that the "query" special case is hidden away inside this spaghetti of specs. Rather, the query is the simplest case and everything else builds on it where necessary.

It strikes me that one of the biggest weaknesses of WS-* is in PR: people seem to believe you need to understand the whole lot in order to achieve anything. Not true. I've certainly never read the WS-Notification spec or many of the others (I probably shouldn't admit that in my line of work but still...)

No comments: