January 2002
Beginner
480 pages
13h 15m
English
The Helma XML-RPC library implementation allows you to build
XML-RPC responders independent of any particular transport
by using an instance of the XmlRpcServer
object, which represents an abstraction of an XML-RPC server. You can
then construct a class—the handler class—containing your
methods to be callable
via XML-RPC. The calling of these methods is coordinated by the
XmlRpcServer object, which you tell about your
handler class using the addHandler() method.
This is what the handler class, called RPCHandler,
looks like:
// RPCHandler: A class of XML-RPC-callable methods
public class RPCHandler
{
// Note: This is a "traditional" list of counties!
private String county[] = {"Bedfordshire", "Berkshire",
"Buckinghamshire", "Cambridgeshire", "Cheshire",
"Cornwall", "Cumberland", "Derbyshire", "Devon", "Dorset",
"Durham", "Essex", "Gloucestershire", "Hampshire", "Herefordshire",
"Hertfordshire", "Humberside", "Huntingdonshire",
"Kent", "Lancashire", "Leicestershire",
"Lincolnshire", "London", "Middlesex", "Norfolk",
"Northamptonshire", "Northumberland", "Nottinghamshire",
"Oxfordshire", "Rutland", "Shropshire",
"Somerset", "Staffordshire", "Suffolk", "Surrey", "Sussex",
"Warwickshire", "Westmorland", "Wiltshire", "Worcestershire",
"Yorkshire"};
public RPCHandler()
{}
public String getCountyName(int c)
{
return county[c - 1];
}
}The class has three elements:
The names of counties are stored in a simple array, county[].
Read now
Unlock full access