FileDocCategorySizeDatePackage
HelloServer.javaAPI DocExample3248Fri Jun 02 15:58:30 BST 2000None

HelloServer

public class HelloServer extends Object
HelloServer is a simple XML-RPC server that will make the HelloHandler class available for XML-RPC calls.
author
Brett McLaughlin
version
1.0

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

Start up the XML-RPC server and register a handler.

        if (args.length < 1) {
            System.out.println(
                "Usage: java HelloServer [port]");
            System.exit(-1);
        }

        try {
            // Use the Apache Xerces SAX Driver
            XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser");

            // Start the server
            System.out.println("Starting XML-RPC Server...");
            WebServer server = new WebServer(Integer.parseInt(args[0]));

            // Register our handler class
            server.addHandler("hello", new HelloHandler());
            System.out.println(
                "Registered HelloHandler class to \"hello\"");

            System.out.println("Now accepting requests...");

        } catch (ClassNotFoundException e) {
            System.out.println("Could not locate SAX Driver");
        } catch (IOException e) {
            System.out.println("Could not start server: " +
                e.getMessage());
        }