Connect to HCL Workload Automation
Describes how to connect to HCL Workload Automation from an event management plug-in.
Connect to HCL Workload Automation with the following code:
private Subject getSubject(String serverName,
String serverPort,
String uid,
String pwd){
Subject subject = null;
try {
LoginContext lc = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,INITIAL_CONTEXT_FACTORY);
env.put(Context.PROVIDER_URL,"corbaloc:iiop:"+serverName+":"+serverPort);
final InitialContext initialContext = new InitialContext(env);
Object obj = initialContext.lookup("");
lc = new LoginContext(JAAS_MODULE, new WSCallbackHandlerImpl(uid,pwd));
lc.login();
subject = lc.getSubject();
} catch(javax.naming.NoPermissionException exc) {
System.err.println("[TWSConn] - Login Error: "+exc);
} catch(Exception exc) {
System.err.println("[TWSConn] - Error: "+exc);
}
return subject;
}
The following user input data is required:
- serverName: your HCL Workload Automation installation name
- serverPort: usually 33116 or 33117
- uid: your HCL Workload Automation user ID
- pwd: your HCL Workload Automation account password