import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.net.URL;

public class SimpleXmlrpc {

    public SimpleXmlrpc() {
    }

    public static void main(String[] args) {

        XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
	    
        try {

            config.setServerURL(new URL("http://localhost:8000/RPC2"));
            XmlRpcClient client = new XmlRpcClient();
            client.setConfig(config);

            Object[] params = new Object[]{ // new String("Some Text"),
	                                    new Integer(args[0]),
                                            new Integer(args[1]),
                                          };

	    String meths = (String)client.execute("system.listMethods", new Object[]{});
	    System.out.println("Methods: " + meths);

		    
            Integer result = (Integer)client.execute("add", params);
            System.out.println("Result of add: " + result);

            result = (Integer)client.execute("pow", params);
            System.out.println("Result of pow: " + result);

            Double result2 = (Double)client.execute("div", params);
            System.out.println("Result of div: " + result2);

        }
        catch(Exception e) {
            System.out.println("Exception: " + e.getMessage());
	}
    }
}
