@Override public List<soapclient.Tool> getToolList(String processId, String userName) { initialURI(); AuthenticationClient authenticationClient = new AuthenticationClient(); String userId = userName + USERID_PROCESS_POSTFIX; String pwd = userName + PASSWORD_PROCESS_POSTFIX; // To check whether this user exist, if not, create it SystemUser systemUser = (SystemUser) authenticationClient.isSystemUserPresent(SystemUser.class, userId); if (!(systemUser.getUserid() != null && systemUser.getUserid().length() > 0)) { SystemUser tempSystemUser = new SystemUser(); tempSystemUser.setUserid(userId); tempSystemUser.setName(userName); tempSystemUser.setPassword(pwd); systemUser = (SystemUser) authenticationClient.createSystemUser_XML(SystemUser.class, tempSystemUser); } else { systemUser.setUserid(userId); systemUser.setName(userName); systemUser.setPassword(pwd); } // Sign in to tool server, so user get access key to server SystemUser authenticatedSystemUser = (SystemUser) authenticationClient.getAccessKey_XML(SystemUser.class, systemUser); System.out.println("system user" + authenticatedSystemUser.getName()); String authKey = authenticatedSystemUser.getCurrentAuthKey(); // initial port soapclient.DesignOntology service = new soapclient.DesignOntology(); soapclient.DesignWorkspaceOntology port = service.getDesignWorkspaceOntologyPort(); // to initial workspace, if this processName has been used before, the initWorkspace will return // false String processName = processId + PROCESS_WORKSPACE_POSTFIX; port.initWorkspace(processName); Map<String, Object> req_ctx = ((BindingProvider) port).getRequestContext(); Map<String, List<String>> headers = new HashMap<String, List<String>>(); headers.put(Constants.userId, Collections.singletonList(userId)); headers.put(Constants.authKey, Collections.singletonList(authKey)); req_ctx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); List<soapclient.Tool> toolsList = (List<soapclient.Tool>) port.getToolsListAvailableForProvisioning(processName); return toolsList; }