📄 xmlrpcclient2.java
字号:
/* * Class.java * * Created on 2006年6月5日, 下午3:26 */////////////////////////begin test2.XmlRPCClient//////////////////////////////////package temp;import java.util.*;import org.apache.xmlrpc.*;public class XmlRPCClient2 {// The location of our server.private final static String server_url ="http://localhost:9001";public static void main(String[] args) { try { XmlRpc.debug = true; XmlRpcClient server = new XmlRpcClient(server_url); // Build our parameter list. Vector params = new Vector(); Vector arg0 = new Vector(); arg0.add("army"); arg0.add("robin"); params.addElement(arg0); Hashtable arg1 = new Hashtable(); arg1.put("a","a"); arg1.put("b","b"); params.addElement(arg1); Integer arg2 = new Integer(3); params.addElement(arg2); Double arg3 = new Double(11.33); params.addElement(arg3); Boolean arg4 = new Boolean(false); params.addElement(arg4); Date arg5 = Calendar.getInstance().getTime(); params.addElement(arg5); // Call the server, and get our result. Object ret = server.execute("sample.getAllUser",params); Vector result = (Vector)ret; if(result!=null){ System.out.println("result:" + result.size() + "records"); for(int i=0;i <result.size();System.out.println("result " + i + "is:" + result.get(i))); } }catch (XmlRpcException exception) { System.err.println("XmlRPCClient: XML-RPC Fault #" + Integer.toString(exception.code) + ": " + exception.toString());}catch (Exception exception) { exception.printStackTrace(System.err);}}}////////////////////////end test2.XmlRPCClient//////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -