inProps.put("action", "UsernameToken Timestamp");
inProps.put("passwordType", "PasswordText");
inProps.put("passwordCallbackClass", "demo.wssec.client.UTPasswordCallback");
GreeterService service = new GreeterService();
Greeter port = service.getGreeterPort();
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
client.getInInterceptors().add(new WSS4JInInterceptor(inProps));
client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
String[] names = new String[] {"Anne", "Bill", "Chris", "Scott"};
// make a sequence of 4 invocations
for (int i = 0; i < 4; i++) {
System.out.println("Invoking greetMe...");
String response = port.greetMe(names[i]);
System.out.println("response: " + response + "\n");
}
if (port instanceof Closeable) {
((Closeable)port).close();