[Baypiggies] Do you think this would be cool open source? / web service discovery

Drew Perttula drewp at bigasterisk.com
Sat May 9 06:50:44 CEST 2009


Shannon -jj Behrens wrote:
> WADL will be really cool when every Web service starts providing the
> WADL file themselves.

That's true, but you don't have to wait for *every* web service nor do 
they have to write their *own* WADL descriptions. If someone translated 
the flickr API docs to WADL, that would be immediately useful. Or so I 
would assume, but I'm happy with the current state

> 
> Drew, you've coded in XML-RPC.  Wasn't that so much easier than REST?
> I think that part of the reason it's easier is because more of the API
> handling gruntwork can be done automatically.

It's about the same, except I don't have several GUI and console 
browsers available for testing xmlrpc. And when the request or response 
is a big binary file, the REST support is better.

I'm using py-restclient, so my calls look like this:

# finally some python on the baypiggies list!
addressBook = restclient.Resource("http://addressbook.com")
addressBook.get("search", first="Drew", phone="12345")
addressBook.post("photo/drewp", open("me.jpg").read(),
                  {'Content-Type' : 'image/jpeg'})

Most of the systems I talk to can return JSON, so my response handling 
in python is usually just a jsonlib.loads() call. I get roughly the same 
type support XMLRPC offers. The services that can only return XML need 
an ElementTree.fromString call, which is certainly more complicated, but 
not terrible.

Now that I think more about it, my development environment is a _lot_ 
better when I'm working with REST than with XMLRPC (again, given the 
systems I'm playing with these days). I test with curl and firebug as 
well as ipython; the REST services I create have doc pages with live 
html form demos in them; huge documents can be streamed; I can insert 
http caches; low-level debugging by sniffing the traffic is reasonable; etc.




That reminds me: I learned from this interesting presentation 
(http://www.infoq.com/presentations/mnot-http-status-1108) that squid 
cache has a cool mode where it can return stale data while it fetches 
new data. See here for a diagram and better description:

  http://www.mnot.net/blog/2007/12/12/stale

That's the kind of thing I never get around to adding to my various 
hand-made caches, yet it seems really useful for high-performance cases.



More information about the Baypiggies mailing list