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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access