Skip to main content

Industrial strength or suds?

A closer look at SOAP, RPC, and RMI

Return to article


Listing 1. Using XML-RPC to reserve airline tickets

// Specify the XML parser to use
XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");
// Specify the server to connect to
XmlRpcClient client =
    new XmlRpcClient("http://rpc.middleearth.com");
// Create the parameters
Vector params = new Vector();
params.addElement(flightNumber);
params.addElement(numSeats);
params.addElement(creditCardType);
params.addElement(creditCardNumber);
// Request reservation
Boolean boughtTickets = (Boolean)client.execute("ticketCounter.buyTickets", params);
// Deal with the response

Return to article