Services

The W3C defines a web service as “a software system designed to support interoperable machine-to-machine interaction over a network”. This is a broad definition, and it encompasses a large number of protocols designed not for machine-to-human communication, but for machine-to-machine communication such as XML, JSON, RSS, etc.

In this chapter we discuss how to expose web services using web2py. If you are interested in examples of consuming third party services (Twitter, Dropbox, etc.) you should look into Chapter 9 and Chapter 14.

web2py provides, out of the box, support for many protocols, including XML, JSON, RSS, CSV, XMLRPC, JSONRPC, AMFRPC, and SOAP. web2py can also be extended to support additional protocols.

Each of those protocols are supported in multiple ways, and we make a distinction between:

  • Rendering the output of a function in a given format (for example XML, JSON, RSS, CSV)
  • Remote Procedure Calls (for example XMLRPC, JSONRPC, AMFRPC)