public SalesWebService() { //GetDataConfiguration(site, web); binding = new BasicHttpBinding() { MaxReceivedMessageSize = 1048576 }; //1048576 = 1mb binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; EndpointAddress endpoint = new EndpointAddress("http://localhost:51372/Services/SalesWS.svc");//http://devsp.kimind.pro:81/_layouts/Lisi/Notifications/LisiNotifications.svc"); proxy = new ServiceSalesWS.SalesWSClient(binding, endpoint); //proxy.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; //proxy.ClientCredentials.Windows.ClientCredential.Domain = this.Domain; //proxy.ClientCredentials.Windows.ClientCredential.UserName = this.UserName; //proxy.ClientCredentials.Windows.ClientCredential.Password = this.Password; proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; }
private void GetProducts() { try { PricingConfigurations pricingConfig = new PricingConfigurations(SPContext.Current.Site.ID, SPContext.Current.Web.ID); if (pricingConfig.IsSuccess) { BasicHttpBinding binding = new BasicHttpBinding() { MaxReceivedMessageSize = 1048576 }; //1048576 = 1mb binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; EndpointAddress endpoint = new EndpointAddress(pricingConfig.URLWebService);//http://localhost:51372/Services/SalesWS.svc ServiceSalesWS.SalesWSClient proxy = new ServiceSalesWS.SalesWSClient(binding, endpoint); //proxy.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; //proxy.ClientCredentials.Windows.ClientCredential.Domain = this.Domain; //proxy.ClientCredentials.Windows.ClientCredential.UserName = this.UserName; //proxy.ClientCredentials.Windows.ClientCredential.Password = this.Password; proxy.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; wsProducts[] Products = proxy.GetProducts(); StringBuilder ProductsLi = new StringBuilder(); for (int i = 0; i < Products.Length; i++) { ProductsLi.Append(string.Format("<li class='ui-widget-content' data-id='{0}'>{1}</li>", Products[i].ProductID.ToString(), Products[i].Name)); } OLProductData.Text = ProductsLi.ToString(); } else { OLProductData.Text = "Error: " + pricingConfig.Message; } } catch (Exception ex) { OLProductData.Text = "Error: " + ex.Message; } }