public WhoisClient(string query) { Errors = new List<KeyValuePair<string, string>>(); var webClient = new WebClient(); XmlDocument searchResult = webClient.DownloadXml(string.Format(searchUri, query)); if (!searchResult.WasLoaded()) { Errors.AddFailedLookupError(string.Format(searchUri, query)); } XmlDocument orgResult = null; var orgUri = string.Empty; if (Errors.AreEmpty()) { orgUri = searchResult["net"]["orgRef"].InnerText; orgResult = webClient.DownloadXml(orgUri); if (!orgResult.WasLoaded()) { Errors.AddFailedLookupError(orgUri); } } XmlDocument pocsSearchResult = null; if (Errors.AreEmpty()) { var pocsSearchUri = string.Format(contactsUri, orgUri); pocsSearchResult = webClient.DownloadXml(pocsSearchUri); if (!pocsSearchResult.WasLoaded()) { Errors.AddFailedLookupError(pocsSearchUri); } } List<XmlDocument> pocsResult = null; if (Errors.AreEmpty()) { pocsResult = new List<XmlDocument>(); foreach (XmlElement poc in pocsSearchResult["pocs"].ChildNodes) { var pocSearchUri = poc.InnerText; var result = webClient.DownloadXml(pocSearchUri); if (!result.WasLoaded()) { Errors.AddFailedLookupError(pocSearchUri); } else { pocsResult.Add(result); } } } if (Errors.AreEmpty()) { whoisRecord = new WhoisRecord().Translate(query, searchResult, orgResult, pocsSearchResult, pocsResult); } }