01 package com.flat502.rox.demo;
02
03 import java.net.URL;
04
05 import com.flat502.rox.client.XmlRpcClient;
06 import com.flat502.rox.processing.HttpRpcProcessor;
07 import com.flat502.rox.processing.SSLConfiguration;
08
09 /**
10 * A demo synchronous client illustrating the {@link com.flat502.rox.client.XmlRpcClient#execute(String, Object[], Class)}
11 * method using SSL.
12 */
13 public class SSLClientDemo {
14 /**
15 * Call each of the exposed methods on the remote demo server.
16 * @param args
17 * A list of parameters. Only the first is used and if
18 * present must be the URL of the remote server. This
19 * defaults to <code>http://localhost:8080/</code> if
20 * not specified.
21 */
22 public static void main(String[] args) {
23 try {
24 String url = "https://localhost:8080/";
25
26 if (args != null && args.length > 0) {
27 url = args[0];
28 }
29 System.out.println("Connecting to " + url);
30
31 XmlRpcClient client = new XmlRpcClient(new URL(url));
32 // Force anonymous SSL
33 client.setCipherSuitePattern(SSLConfiguration.ANON_CIPHER_SUITES);
34 TimeInfo rsp = (TimeInfo)client.execute("example.getDate", null, TimeInfo.class);
35 System.out.println("getDate() returned with");
36 System.out.println(" today is "+rsp.today);
37 System.out.println(" info: "+rsp.info);
38 } catch (Exception e) {
39 e.printStackTrace();
40 }
41 }
42 }
|