Guest User

login_request

a guest
Mar 7th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. private bool login()
  2. {
  3.     Console.Write("Enter username: ");
  4.     string username = Console.ReadLine();
  5.     Console.Write("Enter password: ");
  6.     string password = Console.ReadLine();
  7.  
  8.     loginClient = new SoapClient();
  9.  
  10.     LoginResult lr;
  11.     try
  12.     {
  13.         Console.WriteLine("\nLogging in...\n");
  14.         lr = loginClient.login(null, username, password);
  15.     }
  16.     catch (Exception e)
  17.     {
  18.         Console.WriteLine("An unexpected error has occurred: " + e.Message);
  19.         Console.WriteLine(e.StackTrace);
  20.         return false;
  21.     }
  22.  
  23.     if (lr.passwordExpired)
  24.     {
  25.         Console.WriteLine("An error has occurred. Your password has expired.");
  26.         return false;
  27.     }
  28.  
  29.     endpoint = new EndpointAddress(lr.serverUrl);
  30.     header = new SessionHeader();
  31.     header.sessionId = lr.sessionId;
  32.     // Create and cache an API endpoint client
  33.     client = new SoapClient("Soap", endpoint);
  34.     printUserInfo(lr, lr.serverUrl);
  35.     return true;
  36. }
Add Comment
Please, Sign In to add comment