"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
XML-RPC and SOAP (April 2003)
1. XML-RPC and SOAP
An introduction to two RPC system that use
open Internet standards.
2. What is RPC?
RPC stands for Remote Procedure Call.
RPC is a mechanism for making a procedure
call across applications or machines.
An RPC call involves calling a function with
certain parameters and expecting a result.
Both sides must agree on the format in
which data is passed to and fro.
3. What is XML-RPC?
XML-RPC implements RPC using open Web
standards.
Data is encoded (“marshalled”) in XML using
a special DTD for XML-RPC.
The RPC call is made using HTTP.
The application exporting the function must
implement or be attached to a HTTP server.
4. History of XML-RPC
XML-RPC was created
by Userland Software.
First implementation:
Frontier in April 1998.
Supported universally
now.
Userland also created
SOAP and RSS.
5. The Mechanics
Caller asks library to call a function on a
server with a parameter set.
Library encodes parameters in XML and
makes the call.
Server processes request and returns
results.
Library decodes results from XML and
returns results to caller.
6. Example Python Client
[jace@Jace jace]$ python
Python 2.2.2 (#1, 01/12/03, 07:51:34)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> from xmlrpclib import Server
>>>
7. Example Python Client
[jace@Jace jace]$ python
Python 2.2.2 (#1, 01/12/03, 07:51:34)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> from xmlrpclib import Server
>>> betty = Server("http://betty.userland.com")
>>>
8. Example Python Client
[jace@Jace jace]$ python
Python 2.2.2 (#1, 01/12/03, 07:51:34)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> from xmlrpclib import Server
>>> betty = Server("http://betty.userland.com")
>>> print betty.examples.getStateName(41)
9. Example Python Client
[jace@Jace jace]$ python
Python 2.2.2 (#1, 01/12/03, 07:51:34)
[GCC Apple cpp-precomp 6.14] on darwin
Type "help", "copyright", "credits" or "license" for
more information.
>>> from xmlrpclib import Server
>>> betty = Server("http://betty.userland.com")
>>> print betty.examples.getStateName(41)
South Dakota
>>>
13. More Parameter Types
Array <array>
Collection of items of any data type.
Multiple types are allowed in one array.
Structure <struct>
A structure is a named array, also called a
dictionary or a hash table.
16. Fault Responses
A function call may fail for some reason.
A failed response also uses HTTP code 200.
Instead of a <params> tag containing
results, a <fault> tag containing a fault
code and fault string is returned.
Both code and string are server defined.
17. Limitations
No introspection available.
No access to properties or variables. Only
function calls.
Can’t pass an object as a parameter. No
named parameters either.
HTTP and XML both have processing
overheads. Text consumes more bandwidth.
18. Advantages
Really simple. You can write a client in
minutes, a server in a little longer.
Lightweight. XML-RPC builds on existing
HTTP and XML server and client libraries.
Secure. HTTP already offers basic
authentication, SSL/TLS and cookie auth.
19. Who Uses XML-RPC?
Prominent Examples:
UserLand Software (Manila, Radio)
LiveJournal (now has an XML-RPC API)
Zope (transparent support for XML-RPC)
The KDE Project (kxmlrpc)
Microsoft (Windows NT API; unverified)
20. SOAP
Stands for Simple Object Access Protocol.
Attempts to overcome XML-RPC’s limits.
Is a W3C candidate recommendation.
Created by DevelopMentor, IBM, Lotus,
Microsoft and UserLand Software.
21. SOAP Over XML-RPC
SOAP provides for user-defined data types,
unlike XML-RPC’s limit of eight types.
SOAP with WSDL (Web Services
Description Language) supports object
introspection.
SOAP allows named parameters.
SOAP allows extensive customisation.
22. SOAP Over Others
Is firewall friendly. DCOM and CORBA
dynamically assign ports. SOAP doesn’t.
SOAP is vendor and platform independent.
Is not bound to a protocol. Can be
implemented over HTTP or FTP or SMTP.
HTTP is scalable and easy to administer.
23. Limitations of SOAP
Is neither simple nor lightweight nor easyto-use.
Specification not guaranteed stable yet.
Documentation contains errors.
Too many cooks working on the specification,
not co-operating with each other very well.
24. Not Covered Here
Defining an XML-RPC server.
Detailed examples of XML-RPC requests and
responses.
Details on SOAP.