XML-RPC

XML-RPC (UserLand Software, 1998), SOAP's ancestor, posts a method name and typed parameters (int, string, double, struct, array and a few more) as a small XML document. Python's standard library has both ends:

xmlrpc_demo.py: an XML-RPC server and client in one scriptPython
import threading, xmlrpc.client
from xmlrpc.server import SimpleXMLRPCServer
def get_price(sku):                          # no decimal type in XML-RPC: send a string
    return {"sku": sku, "price": "24.00", "pages": 256, "inStock": False}
server = SimpleXMLRPCServer(("127.0.0.1", 31082), logRequests=False)
server.register_function(get_price, "booknest.getPrice")
threading.Thread(target=server.serve_forever, daemon=True).start()
proxy = xmlrpc.client.ServerProxy("http://127.0.0.1:31082/")
print(proxy.booknest.getPrice("BN-0003"))
server.shutdown()
Output
{'sku': 'BN-0003', 'price': '24.00', 'pages': 256, 'inStock': False}

On the wire the call is <methodCall><methodName>booknest.getPrice</methodName><params><param><value><string> BN-0003 and so on; an unknown method comes back as a <fault> with a code and message. There is no decimal type and no schema. XML-RPC survives in WordPress 48 's xmlrpc.php and Odoo; prefer their REST APIs.


XML RPC

XML Remote Procedure Call (XML-RPC) uses XML 30 to encode calls and HTTP 30 for transport. "XML-RPC" also refers, in general, to the use of XML for remote procedure calls, independently of the specific protocol.

XML-RPC works by sending an HTTP request to a server. Multiple input parameters can be supplied, and one value is returned. These input and output parameters can contain larger structures like lists and maps.

REST transports resources such as documents, while XML-RPC deals with method calls. XML-RPC is simpler than SOAP because XML-RPC:

A typical request:
ch10-xmlrpc-request.xmlXML
<?xml version="1.0"?>
<methodCall>
  <methodName>examples.getStateName</methodName>
  <params>
    <param>
        <value><i4>100</i4></value>
    </param>
  </params>
</methodCall>
A typical response:
ch10-xmlrpc-response.xmlXML
<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
        <value><string>Chong Lip Phang</string></value>
    </param>
  </params>
</methodResponse>
A typical fault:
ch10-xmlrpc-fault.xmlXML
<?xml version="1.0"?>
<methodResponse>
  <fault>
    <value>
      <struct>
        <member>
          <name>faultCode</name>
          <value><int>4</int></value>
        </member>
        <member>
          <name>faultString</name>
          <value><string>Too many parameters.</string></value>
        </member>
      </struct>
    </value>
  </fault>
</methodResponse>