public void IniciaWS() { if (ws.State == CommunicationState.Closed) { BasicHttpBinding binding = CreateBasicHttp(); ws = new IsacClient(binding, EndPoint); //------ Credenciales y SSL -------------------------- ws.ClientCredentials.UserName.UserName = Settings.WebServiceUsr; ws.ClientCredentials.UserName.Password = Settings.WebServicePwd; //------ Credenciales y SSL -------------------------- //ws.Open(); } }
private void InitializeServiceClient() { BasicHttpBinding binding = CreateBasicHttp(); ws = new IsacClient(binding, EndPoint); wsc = new wscatalogos.wscatalogos(); wsc.Url = Settings.WebServiceCat; //------ Credenciales y SSL -------------------------- ws.ClientCredentials.UserName.UserName = Settings.WebServiceUsr; ws.ClientCredentials.UserName.Password = Settings.WebServicePwd; CredentialCache credentialCache = new CredentialCache(); NetworkCredential credentials = new NetworkCredential(Settings.WebServiceUsr, Settings.WebServicePwd); credentialCache.Add(new Uri(wsc.Url), "Basic", credentials); wsc.Credentials = credentialCache; //------ Credenciales y SSL -------------------------- }