I have an error while compiling below source code:
import java.util.*;
import org.apache.xmlrpc.client.*;
import org.apache.xmlrpc.common.*;
import org.apache.xmlrpc.*;
public class pms {
public static void main (String [] args) {
String UserName = "123";
String Password = "123";
String pKey = "123";
XmlRpcClient server = new XmlRpcClient("http://localhost/RPC2"); //("http://localhost/RPC2");
Vector params = new Vector();
try {
params.addElement(new Integer(17));
params.addElement(new Integer(13));
Object result = server.execute("acquire_token",params);
int sum = ((Integer) result).intValue();
System.out.println("The sum is: "+ sum);
} catch (Exception exception) {
System.err.println("JavaClient: " + exception);
}
System.out.println("Hello World");
}
}
The compilation error should state as I guess that there is no constructor for
XmlRpcClient
havingString
, something as below:In fact the
XmlRpcClient
class declares only a default no-arg constructor which you should use to create a new instance.The server URL configuration can be created using
XmlRpcClientConfigImpl
: