📄 helloclient.java
字号:
//客户程序package xmlRpc; /** * (HelloClient)。 首先要做的是创建用于远程过程调用的类和方法,人们常常称之为管理器。 Xml-rpc管理器是一个方法和方法集, 它接受xml-rpc请求,并对请求的内容进行解码,再向一个类和方法发出请求。* <b><code>HelloClient</code></b> is a simple XML-RPC client * that makes an XML-RPC request to <code>HelloServer</code> */ import java.io.IOException; import java.util.Vector; import org.apache.xmlrpc.XmlRpc; import org.apache.xmlrpc.XmlRpcClient; import java.net.MalformedURLException; import org.apache.xmlrpc.XmlRpcException; public class HelloClient { public static void main(String[] args){ //if(args.length<1){ // System.out.println("Usage: java HelloClient [your name]"); //System.exit(-1); // } try{ //Use the Apache Xereces SAX Driver XmlRpc.setDriver("org.apache.xerces.parsers.SAXParser"); //Specify the server XmlRpcClient client = new XmlRpcClient("http://192.168.0.99:8585"); //create request Vector params = new Vector(); //params.addElement(args[0]); params.addElement("smart"); //make a request and print the result String result = (String)client.execute("hello.sayHello",params); System.out.println("Response from server: "+ result); }catch(ClassNotFoundException e){ System.out.println("Could not locate SAX Driver"); }catch(MalformedURLException e){ System.out.println("Incorrect URL fro xml-rpc server foramt:"+e.getMessage()); }catch(XmlRpcException e){ System.out.println("XmlRpcException :"+e.getMessage()); }catch(IOException e){ System.out.println("IOException:"+e.getMessage()); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -