Web Services

More geekage.

I’m writing a web service interface to my company’s tools. The idea of web services is to provide a way of remotely invoking methods that can be transparently streamed through any wire protocol you want to use. This idea is far from new, but the infrastructure is finally in place to make it really simple and obvious how to do it.

The goal is this: I have objects (data with attitude, or sometimes functions with associated data structures) that I would like to make available to other people. The traditional, and in many cases still the simplest, thing to do is to pick up the source code which implements those objects, haul it over to the machine on which I want to make it available, build it, and be done. People who want to use my objects must then link against them or include them (depending on the language).

A more painful, but also well accepted method is to write an interface to every aspect of the objects that I want to share, and put that interface online via either a web page or a special and magical protocol made up just for these objects. If I’m really infected with the “not invented here” bug, I might choose to re-implement the “fork and listen” protocol instead of just using one of the zillion open source solutions to that particular problem. Users must, instead of just calling the functions, write code that speaks my language.

The web services solution is a happy middle ground. We agree on a way to serialize objects (SOAP, the Simple Object Access Protocol, which is a special case of XML). Then, we agree on a way to move around these serialized objects. In this case, we’re going to use HTTP, passing through a web server. Then (and here’s the dark magic) the server makes the objects available to clients and nobody is the wiser about where the code really lives.

For example, a PERL client might look like:

use SOAP::LITE;
my $server = SOAP::Lite -> uri(“http://chris.dwan.org/”);
my %results = $server->do_that_funky_dance();

Benefit: We have been saved the anguish of installing the code for “do_that_funky_dance” on the client side.
Drawback: We had to install and use a SOAP client.

I actually think this is a pretty cool set of technologies. Have any of the rest of you used it / got an opinion?



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.