In this chapter we’ll talk about two closely-related types of service: RPC (Remote Procedure Call) services, and SOAP. These two feel fairly similar to use as they involved calling functions and passing parameters, but their implementations are a stark contrast as the RPC is a very loose way of describing a service, whereas SOAP is very tightly specified.
RPC services quite literally call procedures (i.e. functions) remotely. These types of API will typically have a single endpoint, so all requests are made to the same URL. Each request will include the name of the function to call, and may include some parameters to pass to it. Working with RPC services feels familiar to us as developers because we know how to call functions, and we simply do so over HTTP.
As a quick example, let’s revisit the call we made to flickr earlier (see Fetching data from Flickr’s XMLRPC service). The URL we made for that example was:
Within the URL, you can see the name of the function in the “method” parameter
flickr.photos.search, and the additional fields we pass in; tags to search for a particular tag and a format parameter to ask for the response in XML-RPC format.
There is a distinct difference between using an RPC-style service, with function names and parameters as part of the data we pass, and having a service that is true XML-RPC, which is a very defined format. Which ...