Chapter 5. Web Services and RPC

When you write a networked application, you make information or services accessible over a computer network. Sometimes this is done with the goal of letting people use your program remotely. But more often it’s done to enable other applications to communicate with yours. Providing a way for other programs to communicate with your application makes it more flexible and more valuable. It allows other developers to use your application’s data and services in new ways—possibly even to write new features that you might not have the time or expertise to write yourself.

The concept of one program calling a function in another program over a network is called RPC, or Remote Procedure Calls. RPC can be done in any number of ways, but these days the most common way is to make functions available through the Web. Programmatic interfaces that are available on the Web, meant for use by other applications instead of by a user with a web browser, are known as web services .

This chapter shows how to use web services and RPC in your applications. It demonstrates how to make services available across the network, and how to write client applications that use these services. It discusses four different ways to do this using Twisted: REST, XML-RPC, SOAP, and Twisted’s own Perspective Broker.

Using the REST Architecture for Web Services

In 2000, Roy Thomas Fielding published the paper “Architectural Styles and the Design of Network-based Software Architectures” ( ...

Get Twisted Network Programming Essentials 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.