/// <summary> /// Gets information about all series available for the specific site /// </summary> /// <param name="siteCode">the full site code (networkPrefix:siteCode)</param> /// <returns>A list of all series. The series don't contain any actual data values /// but include all series metadata including the site, variable, source, method\ /// and quality control level.</returns> public IList <SeriesMetadata> GetSiteInfo(string siteCode) { IList <SeriesMetadata> result; if (SaveXmlFiles) { var xmlFile = GetSiteInfoXML(siteCode); using (var fileStream = new FileStream(xmlFile, FileMode.Open)) { result = _parser.ParseGetSiteInfo(fileStream); } } else { var req = WebServiceHelper.CreateGetSiteInfoRequest(_serviceURL, siteCode); req.Timeout = _reqTimeOut * 1000; using (var resp = (HttpWebResponse)req.GetResponse()) { using (var stream = resp.GetResponseStream()) { result = _parser.ParseGetSiteInfo(stream); } } } return(result); }
/// <summary> /// Gets the information about all time series supported by the web service as a XML document /// in the WaterML format /// <param name="fullSiteCode">The full site code in NetworkPrefix:SiteCode format</param> /// </summary> /// <returns>the downloaded xml file name</returns> public string GetSiteInfoXML(string fullSiteCode) { //generate the file name string fileName = "Site-" + fullSiteCode + "-" + GenerateTimeStampString() + ".xml"; fileName = fileName.Replace(":", "-"); fileName = Path.Combine(DownloadDirectory, fileName); HttpWebRequest req = WebServiceHelper.CreateGetSiteInfoRequest(_asmxURL, fullSiteCode); SaveWebResponseToFile(req, fileName); return(fileName); }