Chapter 18. Web Services and Distributed Programming

Distributed programming is like network programming—only the audience is different. The point of network programming is to let a human control a computer across the network. The point of distributed programming is to let computers communicate between themselves.

Humans use networking software to get data and use algorithms they don’t have on their own computers. With distributed programming, automated programs can get in on this action. The programs are (one hopes) designed for the ultimate benefit of humans, but an end user doesn’t see the network usage or even necessarily know that it’s happening.

The simplest and most common form of distributed programming is the web service. Web services work on top of HTTP: they generally involve sending an HTTP request to a certain URL (possibly including an XML or JSON document), and getting a response in the form of another XML or JSON document. Rather than showing this document to an end user the way a web browser would, the web service client parses the response document and does something with it.

We start the chapter with a number of recipes that show how to provide and use web services. We include generic recipes like Recipe 18.3, and recipes for using specific, existing web services like Recipes 18.1 and 18.7. The specific examples are useful in their own right, but they should also help you see what kind of features you should expose in your own web services.

There are three main ...

Get Ruby Cookbook, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.