RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


kXML-RPC Enables Service-Oriented Mobile Computing : Page 3

Service orientation is going wireless; it's simply a matter of how much and how soon. XML-RPC and the kXML-RPC library certainly are in the mix for this inevitable convergence.

How It Works
In the XML-RPC standard, you represent datatypes by enclosing them in specific XML tags. This example indicates the two integer parameters by enclosing them in <i4> tags as highlighted below:


The XML-RPC clients and servers encode the data in this way, and they must map them to the appropriate equivalent platform datatype implementation. In kXML-RPC, the XML-RPC datatypes are mapped to the Java 1.3-compliant datatypes shown in Table 2.

XML-RPC Type Encoding Example Java 1.3 Type
Four-byte signed integer
0 (false) or 1 (true)
<string>I got no time for the jibba-jabba.</string>
Base-64 encoded binary

These are name-value pairs where the name is a string used as a key to retrieve the paired value. The value can be of any valid XML-RPC datatype, including structs and arrays.

The specification for arrays allows for an ordered sequence of any type of valid XML-RPC datatype value.
<string>Foo you!</string>
Table 2. Mappings from XML-RPC Datatypes to the Java 1.3-Compliant Datatypes

The integers and boolean values do not map to int and bool primitives, but to their respective class equivalents. kXML-RPC is designed as such so that these kinds of values can be added to Vectors and Hashtables, because this is how the XML-RPC Struct and Array types are mapped respectively. Also note that when tags are not used to specify a type, the type is assumed to be a String.

kXML-RPC utilizes the kXML parser and serializer to create outgoing messages and process incoming messages. The XmlRpcClient class delegates serialization and parsing to the XmlRpcWriter and XmlRpcParser classes. Figure 1 illustrates the flow of control when the execute method of XmlRpcClient is called.

Click to enlarge

Figure 1. Flow of Control When Execute Method of XmlRpcClient Is Called

The XmlRpcWriter class creates the XML-RPC message and uses an HTTP POST request to send the message to a web service. The payload of the HTTP response is then processed by the XmlRpcParser, where the resulting object is finally returned by the execute method.

XML-RPC Limitations
XML-RPC provides a simple, minimalist XML grammar for invoking service operations. It does not, however, lend itself well to more advanced scenarios. Securing XML-RPC messages is limited to Transport Level Security (TLS) or ad-hoc XML encryption. Additionally, the protocol provides no extension mechanism to facilitate exchange of security tokens, transaction semantics, conversational state, endpoint addressing, intermediary handling, or other enterprise-grade messaging capabilities. If these more sophisticated capabilities are a part of your system requirements, then XML-RPC is not the answer. If, however, you're looking for a quick, streamlined means of exchanging simple data structures between two systems in a neutral fashion, then XML-RPC is just right.

SOA Goes Wireless
As SOA continues to become a more pervasive factor within enterprise information systems, its convergence with mobile computing is inevitable. Service orientation is going wireless; it's simply a matter of how much and how soon. When this occurs, enterprises will need to evaluate their requirements and make a determination regarding the right messaging protocol. XML-RPC and the kXML-RPC library certainly are in the mix.

Kyle Gabhart serves as the SOA Practice Lead for Web Age Solutions, a provider of technology education and mentoring. Since 2001 he has contributed extensively to the SOA/web services body of knowledge as an author, speaker, consultant, and open source contributor. Find Kyle on the Web at http://www.gabhart.com or reads his blog on SOA at SOAmatters.com.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date