作者在 2016-11-17 15:12:46 发布以下内容
package fuck;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.net.URL;
import java.util.Hashtable;
import java.util.*;
public class test {
public static void main (String [] args) {
try {
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(new URL("http://127.0.0.1:9000/RPC2"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Hashtable val = new Hashtable(); //struct
val.put(new String("test_val"), new String("11-22-33-44")); //val.put(new String("test_val"), new String("11-22-33-44"));
Vector params = new Vector(); //array
params.addElement(val); //添加struct到array中
Object[] param = new Object[]{"ECHO", params};
Object[] ack = (Object[]) client.execute("send_cmd", param);
} catch (Exception exception) {
System.err.println("JavaClient: " + exception);
}
}
}