VAStGoodies.com services API

To make the VAStGoodies client work right from the VA image, I needed a service API in addition to the Seaside application that is running on VAStGoodies.com. Requirements for that service include “get all available configuration map names” and “get a download url forĀ a particular version of a configuration map”.

Instead of implementing a full-blown end-to-end SOAP based Webservice, I decided to implement a much leaner RPC-style design that simply returns Smalltalk expressions.

If you visit the service with your browser then you will see something like the following plain text: ((Set new) add: ‘configurationMapNames’; add: ‘configurationMapVersions’; add: ‘index’; add: ‘downloadUrl’; yourself) An experienced Smalltalker directly recognizes this as being the storeString of a Set object. Most Smalltalk objects can represent themselves as an expression by sending the #storeString message.

Unmarshalling this content is simply done by a Smalltalk compiler. So in order to get all available configurationMap names, the client uses code like this: [sourcecode lang=“ruby”] expression := HttpClient new fetch: ‘http://vastgoodies.com/services/configurationMapNames'. avaliableConfigmapNames := EsCompiler evaluate: expression.

Sending the “index” request returns all available service selectors (as shown in the first example). Sending any other message will return an error page to protect the service from unwanted messages such as #halt

comments powered by Disqus