Sunday, June 04, 2006

Not So Practical, But a Digression on Web Services

I was going to use this entry to explain about how to set up a simple web service and access it via AppleScript. It is taking too long, though, so I am going to leave this. I am just editorializing here. I will put some code up for this as well.

----

It is good to sweep the dust out of those corners every once in a while. Web Services is, in some sense, in a corner of the product. It is a late addition and it has not been extended to or added to since.

I find it a bit difficult to talk about Web Services. For one thing, different people have different views of them. Some people get a lot of use from them. Some people do not. Some people say that the WSDL based Web Services, such as those pushed by Sun, are dead and that Microsoft has won the day. That seems like hand-waving to me. WSDL-based Web Services are useful. As long as they are useful, they will be used. And I am never ever really sure that "Web Services", capitalized as it is, is the right way to write this. It just seems wrong somehow. The capitalization seems to give them a grandeur they do not deserve.

It appears the UDDI idea has passed on to a better place, but that concept always seemed strange to me. Let's take something that removes data dependencies, something that is useful because it can be used to tease apart systems with data dependencies on each other, and layer in a lot of other kinds of dependencies. Why would this be a good idea? I never got it. It seemed to me to be a idea that only big companies could love.

Web Services are really only interesting because they are fairly uninteresting. It is a bit like XML. It is most useful when there is really nothing to talk about. One just uses it. Not that this keeps people from writing articles about it, but they have little or no information content, and I do not have to read them and I do not. If one has to get some information from one place and get it to another and one does not want to say very much about the stuff in the middle, use Web Services.

So, I mostly use Web Services in WebObjects in a fairly brain-dead manner. I figure that anything more sophisticated than that is probably not worth the effort. I think that Web Services are often used to make up for bad design. Parts of an organization need to communicate, but they cannot figure out the right way to talk to each other, so they can use Web Services. If I am using Web Services, I do not feel the need to pretend that it is anything more than a hack. In a better world, there would be no need for Web Services, but there we are.

So, I use Direct To Web Services. If I want something smart to be accessible in a Web Service, I give it a name and I have a method in my EO class that will respond to that via key-value-coding. That is it. Really, key-value-coding gives me all the flexibility I need. I do not try to be cute in the WSDL. The WSDL is just a dumb interface to the place where it is easier and more productive to put some smarts, my EO classes.