<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.util.Hashtable;
import org.apache.xmlrpc.*;
    
public class JavaServer {
    
    public JavaServer () {
	// Our handler is a regular Java object. It can have a
	// constructor and member variables in the ordinary fashion.
	// Public methods will be exposed to XML-RPC clients.
    }
    
    public Hashtable sumAndDifference (int x, int y) {
	Hashtable result = new Hashtable();
	result.put("sum", new Integer(x + y));
	result.put("difference", new Integer(x - y));
	return result;
    }
    
    public static void main (String [] args) {
	try {
                
	    // Invoke me as &lt;http://localhost:8080/RPC2&gt;.
	    WebServer server = new WebServer(5763);
	    server.addHandler("sample", new JavaServer());
	    server.start();
	} catch (Exception exception) {
	    System.err.println("JavaServer: " + exception.toString());
	}
    }
}
</pre></body></html>