public void validate() { var binding = new BasicHttpBinding() { Name = "DefaultSoap", AllowCookies = true, MaxReceivedMessageSize = 6553600 }; foreach (ClientLicencingSetup project in Licences.Cache.Inserted) { var endpoint = new EndpointAddress(project.Url); using (DefaultSoapClient client = new DefaultSoapClient(binding, endpoint)) { client.Login(project.Username, project.Password, null, null, null); try { var licence = new AMLicenseSetup(); licence.LicenseKey = new GuidSearch() { Value = project.LicenceKey }; var returnedLicence = (AMLicenseSetup)client.Get(licence); if (returnedLicence.LicenseKey.Value == project.LicenceKey) { project.LastValidationDate = DateTime.Now; project.IsValid = true; } else { project.IsValid = false; } Licences.Update(project); } catch (Exception e) { continue; } finally { client.Logout(); } } } Actions.PressSave(); }
public void validate() { var binding = new BasicHttpBinding() { Name = "DefaultSoap", AllowCookies = true, MaxReceivedMessageSize = 6553600 }; var endpoint = new EndpointAddress(Licencing.Current.Url); using (DefaultSoapClient client = new DefaultSoapClient(binding, endpoint)) { client.Login(Licencing.Current.Username, Licencing.Current.Password, null, null, null); try { var licence = new AMLicenseSetup(); licence.LicenseKey = new GuidSearch() { Value = Licencing.Current.LicenceKey }; var returnedLicence = (AMLicenseSetup)client.Get(licence); if (returnedLicence.LicenseKey.Value == Licencing.Current.LicenceKey) { Licencing.Current.LastValidationDate = DateTime.Now; Licencing.Current.IsValid = true; Licencing.Update(Licencing.Current); Actions.PressSave(); } } catch (Exception e) { throw new PXException("Key not found", e); } finally { client.Logout(); } } }