Home > SOA Tips > The Web Services Advisor > XML and Web services (the beginning): XML-RPC and JAX-RPC
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

THE WEB SERVICES ADVISOR

XML and Web services (the beginning): XML-RPC and JAX-RPC


William Brogden
03.14.2006
Rating: --- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


The original XML-RPC protocol was invented by Web pioneer Dave Winer at UserLand Software in 1998 and first implemented in the UserLand Frontier development platform (in fact, UserLand Software has trademarked "XML-RPC"). The obvious utility of the "XML text transmitted over HTTP" approach subsequently led to the creation of SOAP, with contributions by Winer, Don Box, and others at Microsoft. However, it can be argued that SOAP has become grossly overweight with many features which are totally un-necessary for many applications, so XML-RPC still deserves serious consideration.

The original XML-RPC uses only a few data types and does not require namespaces. It achieves considerable flexibility by defining <struct> and <array> types which can contain other values. Here is an example request from the XML-RPC specification document which specifies single input parameter to the "getStateName" method in the "examples" application.

You have probably already deduced that the tag means a 4 byte integer, here are all the type tags used inside tags to specify how the contents are to be interpreted. String values are assumed if no type tag is used. Note that parameters are not named, the order of elements simply matches the order of method parameters.

There is no way to specify a "null" value for any type in the original specification, but there are extended versions that allow additional types.

Responses are also simple XML with as the root element with either or as the child element. The contrast with complex SOAP responses is striking.

Implementations of XML-RPC

The implementations list at xmlrpc.com gives links to 79 different implementations of the basic XML-RPC protocol in a variety of languages, including five in Java as of December 2003. However, many of these projects appear to be inactive. The project hosted by the Apache Web Services Project is active. ...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
The Web Services Advisor
What to expect with the new JavaScript standardization (ECMAScript 5)
Restlet framework wrestles RESTful Web applications
3 tips for choosing whether to use EGL
Use SoaML to facilitate Model Driven Architecture
Enterprise mashup patterns act as API enablers
XQuery learns to write using XUF
Descriptive Languages for RESTful Services
Notable Python language update on view
Try XML-based Extensible Business Reporting Language (XBRL) for accounting reports
Whatever happened to ''X''?

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


I tried running the current version, 3.0a1, but found that it had mysterious dependencies on other Web services project libraries. It looks like the Apache Web Services Project is on the right track with version 3, so keep an eye on it if you are interested in an open-source XML-RPC solution.

JAX-RPC: The Java API for XML-based RPC

The original push for a Java API was conducted as JSR 101. This effort was started in early 2001 and reached version 1.0 in mid 2002. Version 1.1 was released in 2003 with a reference implementation by Sun in the Java Web Services Developer Pack. In JAX-RPC, the definition of Java primitive types is tied to XML schema types. It also supports more Java standard library objects, for example BigInteger and BigDecimal, and objects that meet the JavaBeans standard. The people working on JSR 101 clearly had the parallel developments in SOAP and other XML technologies in mind.

The Java Web Services Developer Pack (JWSDP) version 1.6 contains, among many other things, an implementation of JAX-RPC 1.1.3.

JAX-WS 2.0: The Next JAX-RPC

The next version of the specification is now known as JAX-WS 2.0, for Java API for XML-Based Web Services instead of JAX-RPC. The development of the standard is being undertaken as Java Specification Request (JSR) 224 and is at the proposed final draft stage.

This next version of JAX-RPC is supposed to significantly reduce the complexity of Web service development, partly by making use of features in the Java 1.5 standard library. You can track the development of the reference implementation at the site shown in the resources list. As of this writing, early access version 3 of the reference implementation is available.

Working with JWSDP 1.6

One of the powerful capabilities in JWSDP 1.6 is Web Services Description Language (WSDL) support. Given a WSDL document describing a Web service, practically all of the client-side code required to access the service and/or the server-side code required to support the service can be generated automatically. In response to a client's request for a simple interface to a published Web service, I used the wscompile tool in JWSDP 1.6 to create client side classes for a WSDL that described 4 possible actions based on three or four input parameters. An astonishing 32 classes were created in a few seconds.

Once I figured out which of these classes provided the real starting point for creating a request, writing the code to provide a simple command line interface was simple. The problem came when I found that in order to run the program, the client would need to add 10 additional jar files from the JWSDP to his Java installation.

Since I was not prepared to help him debug the potential collisions of these jar libraries with other Java programs on his system, I discarded the whole mess and wrote a simple program using string templates to create the SOAP request and XPath to interpret the resulting replies. I concluded that, as the name implies, the JWSDP will mainly be useful to those creating Web services, not those consuming them.

Is XML-RPC Still Useful?

The complexity of the JAX-RPC implementation has caused somewhat of a backlash among programmers. Just try a Google search for "JAX-RPC complexity" to see some user reactions. It seems to me you should consider XML-RPC over JAX-RPC if:


  • Your application uses relatively simple requests
  • You control both server and client sides and/or you don't need to publish a WSDL
  • You want to keep client-side parsing simple (as in AJAX applications)

Resources

XML-RPC Specification

The W3C definition of WSDL

The JAX-WS 2.0 (JAX-RPC 2.0) Project

Apache Software Foundation - Apache XML-RPC

UserLand Frontier


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts