1 16 17 18 package org.apache.xmlrpc.secure; 19 20 import java.net.MalformedURLException ; 21 import java.net.URL ; 22 import java.util.Vector ; 23 24 import org.apache.xmlrpc.XmlRpcClient; 25 26 31 public class SecureXmlRpcClient 32 extends XmlRpcClient 33 { 34 37 public SecureXmlRpcClient (URL url) { 38 super(url); 39 } 40 41 44 public SecureXmlRpcClient (String url) throws MalformedURLException { 45 super(url); 46 } 47 48 51 public SecureXmlRpcClient (String hostname, int port) throws MalformedURLException 52 { 53 super("https://" + hostname + ':' + port + "/RPC2"); 54 } 55 56 59 public void setup() throws Exception 60 { 61 SecurityTool.setup(); 62 } 63 64 67 public static void main (String args[]) throws Exception 68 { 69 try { 71 String url = args[0]; 72 String method = args[1]; 73 Vector v = new Vector (); 74 for (int i=2; i<args.length; i++) try { 75 v.addElement (new Integer (Integer.parseInt (args[i]))); 76 } catch (NumberFormatException nfx) { 77 v.addElement (args[i]); 78 } 79 SecureXmlRpcClient client = new SecureXmlRpcClient (url); 80 try { 81 System.err.println (client.execute (method, v)); 82 } catch (Exception ex) { 83 System.err.println ("Error: "+ex.getMessage()); 84 } 85 } catch (Exception x) { 86 System.err.println (x); 87 System.err.println ("Usage: java " + 88 SecureXmlRpcClient.class.getName() + 89 " <url> <method> [args]"); 90 System.err.println ("Arguments are sent as integers or strings."); 91 } 92 } 93 } 94 | Popular Tags |