public User login() { // Get the service stub SessionService sessionService = SessionService.getService(connection); try { // Prompt for credentials until they are right, or until user // cancels String[] credentials = credentialManager.PromptForCredentials(); while (true) { try { // ***************************** // Execute the service operation // ***************************** LoginResponse resp = sessionService.Login(credentials[0], credentials[1], credentials[2], credentials[3], "", credentials[4]); return(resp.User); } catch (InvalidCredentialsException e) { credentials = credentialManager.GetCredentials(e); } } } // User canceled the operation, don't need to tell him again catch (CanceledOperationException /*e*/) {} // Exit the application //System.exit(0); return(null); }