HelloClient.java
/* * * */ package security; import javax.xml.rpc.Stub; public class HelloClient { public static void main(String[] args) { if (args.length != 4) { System.out.println("Usage: ant run-security"); System.exit(1); } String trustStore = args[0]; String trustStorePassword = args[1]; String username = args[2]; String password = args[3]; System.out.println("trustStore: " + trustStore); System.out.println("trustStorePassword: " + trustStorePassword); System.out.println("username: " + username); System.out.println("password: " + password); try { Stub stub = createProxy(); System.setProperty("javax.net.ssl.trustStore", trustStore); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword); stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, username); stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, password); HelloIF hello = (HelloIF)stub; System.out.println(); System.out.println(hello.sayHello(" Duke (secure)" )); } catch Exception(ex) { ex.printStackTrace(); } } private static Stub createProxy() { // Note: MyHello_Impl is implementation-specific. return (Stub)(new MyHello_Impl().getHelloIFPort()); } }