The Minimum Abstraction09 Jul 2007
So much work is done trying to create abstractions on top of relational databases, it is something of a crime! The OGC’s ebRIM implementation of a catalogue, is basically an abstraction that sits on a database. The Hibernate framework is a Java abstraction that sits on a database. Ruby on Rails is an abstraction that sits on a database. It is almost as if we don’t like our databases! But they are so useful and flexible, let’s expose them, instead of hiding them.
Most “web services” are just method calls that do little more than re-write input parameters into SQL, and return the result as XML!
Why not cut out the middle man, I say? I propose the ur-web-service, just deploy this one web service and then Declare Victory in your corporate web services strategy:
https://yourserver.com/db2xml?sql=<your urlencoded SQL here>
Returns (for example):
<Rows> <Row type="string" name="first_name">Paul</Row> <Row type="string" name="last_name">Ramsey</Row> </Rows>
For security, pull the
HTTP_AUTH_USER and password from the HTTP header and use those to create the database connection, that way all the security beyond simple access is handled by the existing database security layer.
I think this approach (let’s call it the “brain dead approach”) re-invents the minimum number of wheels while providing the maximum quantity of data access flexibility. Perhaps I should write a book; no, a pamphlet; no, a leaflet; no, a business card; on “implementing brain dead web services for the enterprise”.