Java Reference
In-Depth Information
The output for the SiteClient application should resemble the following:
URL: http://www.rdb.com/
Title: rdb
Description: Makers of a very simple quasi-relational database based on Unix
shell commands
NOTE
These random sites are culled from the database of the Open
Directory Project, a directory of more than six million sites at
http://www.dmoz.org. The project's data is available for redistribu-
tion by others at no cost under the terms of the Open Directory
License. For more information, search the directory for the text
“Use of ODP Data.”
Creating an XML-RPC Web Service
An XML-RPC server is a program that receives a request from a client, calls a method in
response to that request, and returns the result. The server maintains a list of methods
that it allows clients to call on; these are different Java classes called handlers .
Apache XML-RPC handles all the XML and networking itself, enabling you to focus on
the task you want a remote method to accomplish.
There are several ways to serve methods remotely with the classes in the org.apache.
xmlrpc package. The simplest is to use the WebServer class, which represents a simple
HTTP web server that only responds to XML-RPC requests.
This class has two constructors:
WebServer( int ) —Create a web server listening on the specified port number.
n
WebServer( int , InetAddress ) —Create a web server at the specified port and IP
address. The second argument is an object of the java.net.InetAddress class.
n
Both constructors throw IOException exceptions if there's an input/output problem cre-
ating and starting the server.
The following statements create an XML-RPC web server on port 4413:
int port = Integer.parseInt(“4413”);
WebServer server = new WebServer(port);
 
Search WWH ::




Custom Search