public string Login(string username, string password) { var callApiForLogin = featureManager.IsEnabledAsync("CallAPIForLogin").Result; if (!callApiForLogin) { var wsUrl = options.Value.AuthWebServiceURL; var webServiceClient = new AuthWebServiceSoapClient(); webServiceClient.Endpoint.Address = new EndpointAddress(wsUrl); var response = webServiceClient.Login(username, password); return($"WebService response from BCL : {response}"); } else { var wapiUrl = options.Value.AuthApiURL; var httpClient = new HttpClient(); var requestBody = System.Text.Json.JsonSerializer.Serialize(new { username = username, password = password }); var stringContent = new StringContent(requestBody, encoding: System.Text.Encoding.UTF8, mediaType: "application/json"); var httpResponse = httpClient.PostAsync($"{wapiUrl}/Login", stringContent).Result; var response = httpResponse.Content.ReadAsStringAsync().Result; return($"WebAPI response from BCL : {response}"); } }
public async Task <string> LoginUsingWebService(string username, string pasword) { var webServiceClient = new AuthWebServiceSoapClient(EndpointConfiguration.AuthWebServiceSoap12, options.Value.AuthWebServiceURL); var response = await webServiceClient.LoginAsync(username, pasword); return($"WebService response: {response}"); }
private int CallWebServiceForCreateUser(string username, string password) { var wsUrl = options.Value.AuthWebServiceURL; var webServiceClient = new AuthWebServiceSoapClient(); webServiceClient.Endpoint.Address = new EndpointAddress(wsUrl); var response = webServiceClient.CreateUser(username, password); return(response); }
public AuthWebServiceSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(AuthWebServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public AuthWebServiceSoapClient(EndpointConfiguration endpointConfiguration) : base(AuthWebServiceSoapClient.GetBindingForEndpoint(endpointConfiguration), AuthWebServiceSoapClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }