try {
log.debug("Soft token req for user '" + userdata.getUsername() + "'.");
userdata.setStatus(UserDataVOWS.STATUS_NEW);
userdata.setClearPwd(true);
final EjbcaWSHelper ejbcawshelper = new EjbcaWSHelper(wsContext, authorizationSession, caAdminSession, certificateProfileSession, certificateStoreSession, endEntityProfileSession, hardTokenSession, userAdminSession);
final Admin admin = ejbcawshelper.getAdmin(false);
logAdminName(admin,logger);
final UserDataVO userdatavo = ejbcawshelper.convertUserDataVOWS(admin, userdata);
final boolean createJKS = userdata.getTokenType().equals(UserDataVOWS.TOKEN_TYPE_JKS);
final byte[] encodedKeyStore = certificateRequestSession.processSoftTokenReq(admin, userdatavo, hardTokenSN, keyspec, keyalg, createJKS);
// Convert encoded KeyStore to the proper return type