public MzkServiceSchedulingServiceClient GetServiceClient() { try { MzkServiceSchedulingServiceClient client; BasicHttpBinding basicHttpBinding = new BasicHttpBinding() { MaxBufferPoolSize = int.MaxValue, MaxBufferSize = int.MaxValue, MaxReceivedMessageSize = int.MaxValue, OpenTimeout = new TimeSpan(2, 0, 0), ReceiveTimeout = new TimeSpan(2, 0, 0), SendTimeout = new TimeSpan(2, 0, 0), AllowCookies = true }; basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; client = new MzkServiceSchedulingServiceClient(basicHttpBinding, new EndpointAddress("http://srfmlbispstg01.lfmd.co.za/MicrosoftDynamicsAXAif60/SSService/xppservice.svc")); client.ClientCredentials.UserName.UserName = "******" + "\"" + "axbcsvc"; client.ClientCredentials.UserName.Password = "******"; client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("axbcsvc", "AXrocks100", "lfmd"); return(client); } catch (Exception) { throw; } }
public MzkServiceSchedulingServiceClient ConnectAsync(string userName, string password, string domain = "lfmd") { try { BasicHttpBinding basicHttpBinding = new BasicHttpBinding() { MaxBufferPoolSize = int.MaxValue, MaxBufferSize = int.MaxValue, MaxReceivedMessageSize = int.MaxValue, OpenTimeout = new TimeSpan(2, 0, 0), ReceiveTimeout = new TimeSpan(2, 0, 0), SendTimeout = new TimeSpan(2, 0, 0), AllowCookies = true }; basicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;//http://srfmlaxtest01/MicrosoftDynamicsAXAif60/SSService/xppservice.svchttp://SRFMLAXTEST01/MicrosoftDynamicsAXAif60/SSService/xppservice.svc client = new MzkServiceSchedulingServiceClient(basicHttpBinding, new EndpointAddress(" http://srfmlbispstg01.lfmd.co.za/MicrosoftDynamicsAXAif60/SSService/xppservice.svc")); client.ClientCredentials.UserName.UserName = domain + "\"" + userName; client.ClientCredentials.UserName.Password = password; client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; client.ClientCredentials.Windows.ClientCredential = new NetworkCredential(userName, password, domain); return(client); } catch (Exception ex) { Util.ShowToast(ex.Message); return(client); } }
async public Task <bool> ValidateUserAsync(MzkServiceSchedulingServiceClient client, string userId, string password) { UserInfo userInfo = new UserInfo(); try { if (client == null) { client = GetServiceClient(); } return(!(await client.validateUserAsync(new CallContext() { }, userId, password)).response); } catch (Exception) { throw; } }