A Simple XML-RPC Client

An XML-RPC request is simply an XML document sent over a network socket. It's easy to use the techniques of this chapter to write a very simple XML-RPC client for a particular service. You just ask the user for the data to send to the server, wrap it up in some XML, and write it onto a URL object pointing at the server. The response will come back in XML as well. Since we haven't yet learned how to read XML documents, I'll just dump the response as text to System.out. Later we'll pay more attention to the response and add a nicer user interface.

The specific XML-RPC service we're going to talk to is a Fibonacci generator I'll develop in later chapters. The request passes an int to the server. The server responds with the ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.