XML-RPC

from Wikipedia, the free encyclopedia

XML-RPC ( Extensible Markup Language Remote Procedure Call ) is a definition for method or function calls by distributed systems .

General

During the specification, emphasis was placed on the fact that XML-RPC can be implemented without great effort in different programming languages and on different system platforms. For this reason, too, two standards were combined for implementation: The Hypertext Transfer Protocol (HTTP) was used to transport the data , while the data transferred is represented in the Extensible Markup Language (XML).

The choice of these standards also represents the essential difference to older RPC mechanisms, such as RPC , Corba or DCOM , in which the data is usually transmitted in a (partially system-dependent: DCOM) binary representation via special transmission protocols.

Historically, XML-RPC is the predecessor of SOAP , but in contrast to it, it is much leaner and easier to understand.

There are numerous implementations for many of the programming languages ​​commonly used today that take over the basic functionality of method calls and method handling. The basic functionalities in these libraries include:

  • Representation of the data types ,
  • Generation and analysis of the request and response packets,
  • Transmission and reception of the same and
  • often the provision of skeleton and stub to simply “fill with life” the program code.

The following data types are defined in XML-RPC:

Type name (s) in XML-RPC description
int, i4 Integer (data type)
double Floating point number
boolean Boolean variable
string String
dateTime.iso8601 Date and time similar to ISO format
base64 Base64 encoded binary data

Several of these simple data types can be combined using “struct” and “array”. A “struct” represents a collection of key-value pairs; every contained value can therefore be accessed using a unique key. An “array”, on the other hand, represents a list ; each contained value is clearly described by its position. In addition to the simple data types, “struct” s and “array” s, in turn “struct” s and “array” s, can contain values; any complex data structures can be represented.

In Java , the data type corresponding to the “struct” is the so-called map (java.util.Map). Most of the implementations use the HashTable class for display, which implements the Map interface, but has existed in Java for a long time. The data type corresponding to the “array” is the so-called List (java.util.List) or an object array in Java.

Extensions to the standard

There are various extensions of the standard in order to close alleged gaps in the standard. Most of the time, however, these extensions are based on a misunderstanding of what XML-RPC is and endanger the interoperability of different systems. Therefore, most implementations also offer a switch to switch to a compatibility mode in which only the standard is supported.

Null data type

The representation of so-called zero values (also known as NIL, NULL or NUL) is not possible with XML-RPC. Methods must therefore always return a concrete value, in rare cases this can be a problem. There are various extensions to the XML-RPC standard to resolve this problem, but not all servers and clients support these extensions.

Examples

inquiry

 <?xml version="1.0"?>
 <methodCall>
   <methodName>warenkorb.addPosition</methodName>
   <params>
     <param>
       <value><string>Monitor</string></value>
     </param>
     <param>
       <value><int>10</int></value>
     </param>
   </params>
 </methodCall>

answer

 <?xml version="1.0"?>
 <methodResponse>
   <params>
     <param>
       <value><string>OK</string></value>
     </param>
   </params>
 </methodResponse>

Code example: Linux Documentation Project

See also

Web links

Individual evidence

  1. XML-RPC uses the date in the format YYYYmmdd'T'HH: MM: SS and without specifying a time zone.
  2. for example: ontosys.com ( Memento from March 9, 2007 in the Internet Archive )
  3. Eric Kidd: XML-RPC HOWTO ( English ) tldp.org. April 12, 2001. Retrieved September 14, 2019.