- XML Reference Guide
- Overview
- What Is XML?
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Table of Contents
- The Document Object Model
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- DOM and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Implementations
- DOM and JavaScript
- Using a Repeater
- Repeaters and XML
- Repeater Resources
- DOM and .NET
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Downloads
- DOM and C++
- DOM and C++ Resources
- DOM and Perl
- DOM and Perl Resources
- DOM and PHP
- DOM and PHP Resources
- DOM Level 3
- DOM Level 3 Core
- DOM Level 3 Load and Save
- DOM Level 3 XPath
- DOM Level 3 Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- The Simple API for XML (SAX)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SAX and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- SAX and .NET
- Informit Articles and Sample Chapters
- SAX and Perl
- SAX and Perl Resources
- SAX and PHP
- SAX and PHP Resources
- Validation
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Document Type Definitions (DTDs)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Schemas
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- RELAX NG
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Schematron
- Official Documentation and Implementations
- Validation in Applications
- Informit Articles and Sample Chapters
- Books and e-Books
- XSL Transformations (XSLT)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XSLT in Java
- Java in XSLT Resources
- XSLT and RSS in .NET
- XSLT and RSS in .NET Resources
- XSL-FO
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XPath
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XML Base
- Informit Articles and Sample Chapters
- Official Documentation
- XHTML
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XHTML 2.0
- Documentation
- Cascading Style Sheets
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XUL
- XUL References
- XML Events
- XML Events Resources
- XML Data Binding
- Informit Articles and Sample Chapters
- Books and e-Books
- Specifications
- Implementations
- XML and Databases
- Informit Articles and Sample Chapters
- Books and e-Books
- Online Resources
- Official Documentation
- SQL Server and FOR XML
- Informit Articles and Sample Chapters
- Books and e-Books
- Documentation and Implementations
- Service Oriented Architecture
- Web Services
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Creating a Perl Web Service Client
- SOAP::Lite
- Amazon Web Services
- Creating the Movable Type Plug-in
- Perl, Amazon, and Movable Type Resources
- Apache Axis2
- REST
- REST Resources
- SOAP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- SOAP and Java
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- WSDL
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- UDDI
- UDDI Resources
- XML-RPC
- XML-RPC in PHP
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Ajax
- Asynchronous Javascript
- Client-side XSLT
- SAJAX and PHP
- Ajax Resources
- JSON
- Ruby on Rails
- Creating Objects
- Ruby Basics: Arrays and Other Sundry Bits
- Ruby Basics: Iterators and Persistence
- Starting on the Rails
- Rails and Databases
- Rails: Ajax and Partials
- Rails Resources
- Web Services Security
- Web Services Security Resources
- SAML
- Informit Articles and Sample Chapters
- Books and e-Books
- Specification and Implementation
- XML Digital Signatures
- XML Digital Signatures Resources
- XML Key Management Services
- Resources for XML Key Management Services
- Internationalization
- Resources
- Grid Computing
- Grid Resources
- Web Services Resource Framework
- Web Services Resource Framework Resources
- WS-Addressing
- WS-Addressing Resources
- WS-Notifications
- New Languages: XML in Use
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Google Web Toolkit
- GWT Basic Interactivity
- Google Sitemaps
- Google Sitemaps Resources
- Accessibility
- Web Accessibility
- XML Accessibility
- Accessibility Resources
- The Semantic Web
- Defining a New Ontology
- OWL: Web Ontology Language
- Semantic Web Resources
- Google Base
- Microformats
- StructuredBlogging
- Live Clipboard
- WML
- XHTML-MP
- WML Resources
- Google Web Services
- Google Web Services API
- Google Web Services Resources
- The Yahoo! Web Services Interface
- Yahoo! Web Services and PHP
- Yahoo! Web Services Resources
- eBay REST API
- WordML
- WordML Part 2: Lists
- WordML Part 3: Tables
- WordML Resources
- DocBook
- Articles
- Books and e-Books
- Official Documentation and Implementations
- XML Query
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- XForms
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Resource Description Framework (RDF)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Topic Maps
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation, Implementations, and Other Resources
- Rich Site Summary (RSS)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- Simple Sharing Extensions (SSE)
- Atom
- Podcasting
- Podcasting Resources
- Scalable Vector Graphics (SVG)
- Informit Articles and Sample Chapters
- Books and e-Books
- Official Documentation
- OPML
- OPML Resources
- Summary
- Projects
- JavaScript TimeTracker: JSON and PHP
- The Javascript Timetracker
- Refactoring to Javascript Objects
- Creating the Yahoo! Widget
- Web Mashup
- Google Maps
- Indeed Mashup
- Mashup Part 3: Putting It All Together
- Additional Resources
- Frequently Asked Questions About XML
- What's XML, and why should I use it?
- What's a well-formed document?
- What's the difference between XML and HTML?
- What's the difference between HTML and XHTML?
- Can I use XML in a browser?
- Should I use elements or attributes for my document?
- What's a namespace?
- Where can I get an XML parser?
- What's the difference between a well-formed document and a valid document?
- What's a validating parser?
- Should I use DOM or SAX for my application?
- How can I stop a SAX parser before it has parsed the entire document?
- 2005 Predictions
- 2006 Predictions
- Nick's Book Picks
While enterprise web services will probably settle in on a standard based on SOAP or some variety of it, another important format is XML-RPC. XML-RPC is a less flexible type of message than a SOAP message, intended specifically for executing Remote Procedure Calls, or functions on a remote server.
First developed by Dave Winer of Radio Userland, XML-RPC is used for applications such as alerting Weblogs.com to changes in a weblog, or for the Internet Topic Exchange, to add a new message to a channel. In your own applications, you may find it convenient to use XML-RPC when all you want to do is tell the server to do something.
For example, I could use XML-RPC to tell Weblogs.com that I've updated my personal site by sending a message to http://rpc.weblogs.com/RPC2:
<?xml version="1.0"?> <methodCall> <methodName>weblogUpdates.ping</methodName> <params> <param> <value>The Vanguard Science Fiction Report</value> </param> <param> <value>http://www.vanguardreport.com/phpnuke/index.php</value> </param> </params> </methodCall>
This tells the server at rpc.weblogs.com to execute the method:
weblogUpdates.ping("The Vanguard Science Fiction Report", "http://www.vanguardreport.com/phpnuke/index.php")
I don't need to know (or care) what platform weblogs.com is running; the RPC server on the other end takes care of that for me.
When I send the message, I get back a response. That response could be a fault, or it could be a success message. In this case, if my page has changed, I'd get a response back of
<?xml version="1.0"?> <methodResponse> <params> <param> <value> <struct> <member> <name>flerror</name> <value> <boolean>0</boolean> </value> </member> <member> <name>message</name> <value>Thanks for the ping. We checked and found that the "The Vanguard Science Fiction Report" weblog has changed, so it will appear in <a href="http://www.weblogs.com/changes.xml">changes.xml </a> next time it is updated.</value> </member> </struct> </value> </param> </params> </methodResponse>
Notice that the return message has both parameter names and, in the case of the boolean value, a data type. We could just as easily have sent the original request as
<?xml version="1.0"?> <methodCall> <methodName>weblogUpdates.ping</methodName> <params> <param> <name>weblogname</name> <value><string>The Vanguard Science Fiction Report</string></value> </param> <param> <name>weblogurl</name> <value><string>http://www.vanguardreport.com/phpnuke/index.php</string></value> </param> </params> </methodCall>
XML-RPC defines 7 different types: string, boolean, dateTime.iso8601, i4, int, double, and base64, with arrays and structs for record-type information.
In most cases, you'll use XML-RPC without directly constructing the messages. For example, I sent the above message with a Java implementation of XML-RPC from the Apache project (downloadable here). The class simply constructed the message and sent it:
import org.apache.xmlrpc.XmlRpcClient; import java.util.Vector; public class TestTopic { public static void main(String[] args) { try { XmlRpcClient xmlrpc = new XmlRpcClient ("http://rpc.weblogs.com/RPC2"); Vector params = new Vector (); params.addElement ("The Vanguard Science Fiction Report"); params.addElement ("http://www.vanguardreport.com/phpnuke/index.php"); Object result = xmlrpc.execute ("weblogUpdates.ping", params); System.out.println(result.toString()); } catch (Exception e) { e.printStackTrace(); } } }
It's important to understand that while XML-RPC is will suited to remote procedure calls, it does have several signficant limitations. There is no way to add additional XML data without turning it into a binary file, and there is no mechanism for describing the service for other developers, as we can do for a SOAP service using a WSDL file. Security is also lacking.
On the other hand, it's simple to use, and if these issues aren't a concern for you, XML-RPC can be a simple way to dip your toes into web services.