Chapter 14. Web Services

So far, we've covered what XML is and how to create well-formed and valid XML documents, and you've even seen a couple of programmatic interfaces into XML documents in the form of DOM and SAX. We also discussed the fact that XML isn't really a language on its own; it's a meta language, to be used in the creation of other languages.

This chapter takes a slightly different turn. Rather than discuss XML itself, it covers an application of XML: web services enable objects on one computer to call and make use of objects on other computers. In other words, web services are a means of performing distributed computing.

This chapter includes the following:

  • What a remote procedure call (RPC) is, and what RPC protocols exist currently

  • Why web services can provide more flexibility than previous RPC protocols

  • How XML-RPC works

  • Why most web services implementations should use HTTP as a transport protocol, and how HTTP works under the hood

  • How the specifications that surround web services fit together

What Is an RPC?

It is often necessary to design distributed systems, whereby the code to run an application is spread across multiple computers. For example, to create a large transaction processing system, you might have a separate server for business logic objects, one for presentation logic objects, a database server, and so on, all of which need to talk to each other (see Figure 14-1).

In order for a model like this to work, code on one computer needs to call code on another computer. ...

Get Beginning XML, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.