/// <summary> /// Gets the information about all sites available at this web service. /// </summary> /// <returns>The list of all sites supported by this web service.</returns> public IList <Site> GetSites() { IList <Site> result; if (SaveXmlFiles) { var xmlFile = GetSitesXML(); using (var fileStream = new FileStream(xmlFile, FileMode.Open)) { result = _parser.ParseGetSites(fileStream); } } else { var req = WebServiceHelper.CreateGetSitesRequest(_serviceURL); req.Timeout = _reqTimeOut * 1000; using (var resp = (HttpWebResponse)req.GetResponse()) { using (var stream = resp.GetResponseStream()) { result = _parser.ParseGetSites(stream); } } } return(result); }
/// <summary> /// Gets the information about all sites in the web service as a XML document in the WaterML format /// </summary> /// <returns>The downloaded XML file name</returns> public string GetSitesXML() { //generate the file name var fileName = Path.Combine(DownloadDirectory, "sites" + GenerateTimeStampString() + ".xml"); var req = WebServiceHelper.CreateGetSitesRequest(_serviceURL); req.Timeout = _reqTimeOut * 1000; SaveWebResponseToFile(req, fileName); return(fileName); }
/// <summary> /// Gets the information about all sites in the web service as a XML document in the WaterML format /// </summary> /// <returns>The downloaded XML file name</returns> public string GetSitesXML() { //generate the file name string fileName = Path.Combine(DownloadDirectory, "sites" + GenerateTimeStampString() + ".xml"); HttpWebRequest req = WebServiceHelper.CreateGetSitesRequest(_asmxURL); SaveWebResponseToFile(req, fileName); return(fileName); }