Hi, I implemented XML-RPC client and server on localhost.The server is running ok.but when I run client following errors occurred:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException at org.apache.xmlrpc.XmlRpc.createTypeFactory(XmlRpc.java:235) at org.apache.xmlrpc.XmlRpc.(XmlRpc.java:190) at org.apache.xmlrpc.XmlRpcClientResponseProcessor.(XmlRpcClientResponseProcessor.java:49) at org.apache.xmlrpc.XmlRpcClientWorker.(XmlRpcClientWorker.java:44) at org.apache.xmlrpc.XmlRpcClient.getWorker(XmlRpcClient.java:351) at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:191) at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:185) at org.apache.xmlrpc.XmlRpcClient.execute(XmlRpcClient.java:178) at rpcpkg.RPCClientDemo.main(RPCClientDemo.java:16)
I have kept server JAVA file on C:\wamp\www\workspace3\JAVARPC\RPCSRC\rpcpkg\RPCServerDemo.java
Below is my code for client : package rpcpkg;
import java.util.*; import org.apache.xmlrpc.XmlRpcClient; public class RPCClientDemo {
public static void main (String [] args) {
try {
XmlRpcClient server = new XmlRpcClient("http://localhost/workspace3/JAVARPC/RPCSRC/rpcpkg");
Vector params = new Vector();
params.addElement(new Integer(17));
params.addElement(new Integer(13));
Object result = server.execute("sample.sum", params);
int sum = ((Integer) result).intValue();
System.out.println("The sum is: "+ sum);
} catch (Exception exception) {
System.err.println("JavaClient: " + exception);
}
}
}