1 16 17 18 package org.apache.xmlrpc; 19 20 import java.net.MalformedURLException ; 21 import java.net.URL ; 22 import java.util.Vector ; 23 24 33 public class XmlRpcClientLite extends XmlRpcClient 34 { 35 38 public XmlRpcClientLite (URL url) 39 { 40 super (url); 41 } 42 43 46 public XmlRpcClientLite (String url) throws MalformedURLException 47 { 48 super (url); 49 } 50 51 54 public XmlRpcClientLite (String hostname, int port) 55 throws MalformedURLException 56 { 57 super (hostname, port); 58 } 59 60 protected XmlRpcTransport createTransport() 61 { 62 return new LiteXmlRpcTransport(url); 63 } 64 65 68 public static void main(String args[]) throws Exception 69 { 70 try 72 { 73 String url = args[0]; 74 String method = args[1]; 75 XmlRpcClientLite client = new XmlRpcClientLite (url); 76 Vector v = new Vector (); 77 for (int i = 2; i < args.length; i++) 78 { 79 try 80 { 81 v.addElement(new Integer (Integer.parseInt(args[i]))); 82 } 83 catch (NumberFormatException nfx) 84 { 85 v.addElement(args[i]); 86 } 87 } 88 try 90 { 91 System.out.println(client.execute(method, v)); 92 } 93 catch (Exception ex) 94 { 95 System.err.println("Error: " + ex.getMessage()); 96 } 97 } 98 catch (Exception x) 99 { 100 System.err.println(x); 101 System.err.println("Usage: java org.apache.xmlrpc.XmlRpcClient " 102 + "<url> <method> <arg> ...."); 103 System.err.println("Arguments are sent as integers or strings."); 104 } 105 } 106 } 107 | Popular Tags |