/// <summary> /// GetToken must be the first call into web service. /// This is irrespective of whether user is logging in or not. /// </summary> /// <returns>Unique access token that is valid for the duration of the session.</returns> public string GetToken() { TokenRequest request = new TokenRequest(); request.RequestId = NewRequestId; request.ClientTag = ClientTag; TokenResponse response = ActionServiceClient.GetToken(request); if (request.RequestId != response.CorrelationId) { throw new ApplicationException("GetToken: RequestId and CorrelationId do not match."); } return(response.AccessToken); }
/// <summary> /// Static constructor of provider. /// </summary> static Provider() { Client = new ActionServiceClient(); // Gets client tag from app.config configuration file ClientTag = ConfigurationManager.AppSettings.Get("ClientTag"); // Retrieve AccessToken as first step var request = PrepareRequest(new TokenRequest()); var response = Client.GetToken(request); // Store access token for subsequent service calls. AccessToken = response.AccessToken; }