HP CloudSystem Matrix/Matrix Operating Environment 7.0 Integration Interfaces API and CLI Operations Reference Guide

new LeasePeriod(), // Start now and never expire
"hostx", // Hostname completion text
null, // Use all available server pools
null, // Do not set user's email address
"Service Purpose", // Annotation for the new service
"MyBillingCode");
RequestStatus requestStatus =
waitForTerminalStatus(port, requestId);
System.out.println("Operation completed with status: " +
requestStatus.getEnumValue());
} catch (Exception e) {
System.out.println("Operation failed with exception: " +
e.getMessage());
}
System.out.println("Invoking deactivateService...");
try {
String requestId = port.deactivateService(infServiceName);
RequestStatus requestStatus =
waitForTerminalStatus(port, requestId);
System.out.println("Operation completed with status: " +
requestStatus.getEnumValue());
} catch (Exception e) {
System.out.println("Operation failed with exception: " +
e.getMessage());
}
System.out.println("Invoking activateService...");
try {
String requestId = port.activateService(infServiceName,null);
RequestStatus requestStatus =
waitForTerminalStatus(port, requestId);
System.out.println("Operation completed with status: " +
requestStatus.getEnumValue());
} catch (Exception e) {
System.out.println("Operation failed with exception: " +
e.getMessage());
}
System.exit(0);
}
/**
* Initializes the security settings for the web service client.
*/
private static void setupConnection(IO port) {
final String USER_NAME = "MyUserName";
final String PASSWORD = "MySecretPassword";
Client proxy = ClientProxy.getClient(port);
// Configure WS-Security UsernameToken parameters
Endpoint cxfEndpoint = proxy.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION,
WSHandlerConstants.USERNAME_TOKEN + " " +
WSHandlerConstants.TIMESTAMP);
outProps.put(WSHandlerConstants.USER, USER_NAME);
outProps.put(WSHandlerConstants.PASSWORD_TYPE,
WSConstants.PW_TEXT);
IOClientPasswordHandler.setPassword(PASSWORD);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS,
IOClientPasswordHandler.class.getName());
outProps.put(WSHandlerConstants.TTL_TIMESTAMP, "1800");
outProps.put(WSHandlerConstants.TIMESTAMP_PRECISION, "false");
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
Sample Code 53