📄 hclient.java
字号:
//客户程序package temp; /** * * <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 HClient { public static void main(String[] args){ if(args.length<1){ System.out.println("Usage: java HClient [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://localhost:8585"); //create request Vector params = new Vector(); params.addElement(args[0]); //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 + -