Declarative web services (2)

Posted by Patrice Neff Mon, 26 May 2008

On Friday I posted an idea about declarative web services which had been growing for a while.

As luck would have it today we had a hack day at local.ch, so I got to spend a workday on that idea. I got positive feedback from my co-workers, so I have now published the skeleton on github. The project is called “servicegen” for now – no nice name has come up yet. ;-)

See the README on github for information about the ideas.

Declarative web services

Posted by Patrice Neff Fri, 23 May 2008

I’ve been developing a lot of web services lately. I usually do this with Okapi and web.py.

Somehow the tasks for creating a web service are always more or less the same.

  • Specify URL schema
  • Validate input parameters
  • Request data: either from a database or from at least one other web service
  • Identify output format using URL or HTTP headers
  • Output data in the correct format

And I think that even web.py doesn’t do a good enough job of making this easy and really fast.

I’m starting to think that a DSL might be the correct way to that. The only project I know which partially does that is ActiveWebService from the Ruby on Rails project.

I just hacked together two very simple prototypes of how such service specification could look. I’m interested in two things:

  • Does something like that exist already?
  • Is it a stupid idea?

See my two examples derived from real services I developed inside local.ch:

  • Meteo – providing weather forecast data which is written regularly into a database (by a process not defined here).
  • Wintersport – a service providing information about skiing locations based on data from MySwitzerland