public object GetValuesObject(string location, string variable, string startDate, string endDate, String authToken) { if (!useODForValues) { throw new SoapException( "GetValues implemented external to this service. Call GetSiteInfo, and SeriesCatalog includes the service Wsdl for GetValues. Attribute:serviceWsdl on Element:seriesCatalog XPath://seriesCatalog/[@serviceWsdl]", new XmlQualifiedName("ServiceException")); } Stopwatch timer = System.Diagnostics.Stopwatch.StartNew(); queryLog2.LogValuesStart(Logging.Methods.GetValues, // method location, //location variable, //variable startDate, // startdate endDate, //enddate Context.Request.UserHostName); try { WaterOneFlowImpl.locationParam lParam = new locationParam(location); VariableParam vparam = new VariableParam(variable); W3CDateTime? startDt = null; W3CDateTime? endDt = null; if (!String.IsNullOrEmpty(startDate)) { startDt = new W3CDateTime(DateTime.Parse(startDate)); } if (!String.IsNullOrEmpty(endDate)) { endDt = new W3CDateTime(DateTime.Parse(endDate)); } USGSwebService.TimeSeriesResponseType res = (USGSwebService.TimeSeriesResponseType)dvSvc.GetTimeSeries(lParam, vparam, startDt, endDt); if (res.timeSeries.values.value != null) { queryLog2.LogValuesEnd(Logging.Methods.GetValues, location, //location variable, //variable startDate, // startdate endDate, //enddate timer.ElapsedMilliseconds, res.timeSeries.values.value.Length, Context.Request.UserHostName); } else { queryLog2.LogValuesEnd(Logging.Methods.GetValues, location, //location variable, //variable startDate, // startdate endDate, //enddate timer.ElapsedMilliseconds, 0, Context.Request.UserHostName); } return(new NWISUVTimeSeriesResponse(res));// this one is an original class } catch (Exception we) { log.Warn(we.Message); queryLog2.LogValuesEnd(Logging.Methods.GetValues, location, //locaiton variable, //variable startDate, // startdate endDate, //enddate timer.ElapsedMilliseconds, // processing time -9999, // count Context.Request.UserHostName ); throw SoapExceptionGenerator.WOFExceptionToSoapException(we); } }
public object GetValuesObject(string location, string variable, string startDate, string endDate, String authToken) { if (!useODForValues) { throw new SoapException("GetValues implemented external to this service. Call GetSiteInfo, and SeriesCatalog includes the service Wsdl for GetValues. Attribute:serviceWsdl on Element:seriesCatalog XPath://seriesCatalog/[@serviceWsdl]", new XmlQualifiedName("ServiceException")); } Stopwatch timer = System.Diagnostics.Stopwatch.StartNew(); queryLog2.LogValuesStart(Logging.Methods.GetValues, // method location, //location variable, //variable startDate, // startdate startDate, //enddate Context.Request.UserHostName); try { WaterOneFlowImpl.locationParam lParam = new locationParam(location); VariableParam vparam = new VariableParam(variable); W3CDateTime? startDt = null; W3CDateTime? endDt = null; if (!String.IsNullOrEmpty(startDate)) { startDt = new W3CDateTime(DateTime.Parse(startDate)); } if (!String.IsNullOrEmpty(endDate)) { endDt = new W3CDateTime(DateTime.Parse(endDate)); } // see using statement above for full namespace USGSwebService.TimeSeriesResponseType res = (NwisWOFService.gov.usgs.nwis.dailyValues.TimeSeriesResponseType)dvSvc.GetTimeSeries(lParam, vparam, startDt, endDt); // minor editing, add network codes. foreach (USGSwebService.TimeSeriesType ts in res.timeSeries) { if (ts.sourceInfo.GetType().Name.Contains("SiteInfoType")) { USGSwebService.SiteInfoType sit = (USGSwebService.SiteInfoType)ts.sourceInfo; foreach (USGSwebService.SiteInfoTypeSiteCode sCode in sit.siteCode) { if (sCode.network == null && string.IsNullOrEmpty(sCode.network)) { sCode.network = ODws.SiteVocabulary; } } } } // need to check is sourceInfo is of siteInfoType... but no siteInfoType //NwisWOFService.gov.usgs.nwis.dailyValues.TimeSeriesType[] tst = res.timeSeries; //if (tst[0].sourceInfo.GetType().IsInstanceOfType(NwisWOFService.gov.usgs.nwis.dailyValues.) string count = "0"; if (res != null && res.timeSeries[0] != null && res.timeSeries[0].values[0].value != null) { count = res.timeSeries[0].values[0].value.Length.ToString(); } queryLog2.LogEnd(Logging.Methods.GetValues, location, timer.ElapsedMilliseconds.ToString(), count, Context.Request.UserHostName); return(new NWISTimeSeriesResponse(res)); //if (res != null && res.timeSeries != null && // res.timeSeries.values != null && // res.timeSeries.values.value != null) //{ // queryLog2.LogValuesEnd(Logging.Methods.GetValues, // location, //locaiton // variable, //variable // startDate, // startdate // startDate, //enddate // timer.ElapsedMilliseconds, // processing time // res.timeSeries.values.value.Length, // count // Context.Request.UserHostName // ); //} //else //{ // queryLog2.LogValuesEnd(Logging.Methods.GetValues, // location, //locaiton // variable, //variable // startDate, // startdate // startDate, //enddate // timer.ElapsedMilliseconds, // processing time // 0, // count // Context.Request.UserHostName // ); //} //// add query info //if (res.queryInfo == null) res.queryInfo = new QueryInfoType(); //res.queryInfo.creationTime = DateTime.Now.ToLocalTime(); //res.queryInfo.creationTimeSpecified = true; //QueryInfoTypeCriteria crit = new QueryInfoTypeCriteria(); //if (String.IsNullOrEmpty(location)) //{ // crit.locationParam = "none"; //} //else //{ // crit.locationParam = location; //} //if (String.IsNullOrEmpty(variable)) //{ // crit.locationParam = "none"; //} //else //{ // crit.variableParam = variable; //} //crit.timeParam = // CuahsiBuilder.createQueryInfoTimeCriteria(startDate, endDate); //res.queryInfo.criteria = crit; //return res; } catch (Exception we) { log.Warn(we.Message); queryLog2.LogValuesEnd(Logging.Methods.GetValues, location, //locaiton variable, //variable startDate, // startdate startDate, //enddate timer.ElapsedMilliseconds, // processing time -9999, // count Context.Request.UserHostName ); throw SoapExceptionGenerator.WOFExceptionToSoapException(we); } }