Exemplo n.º 1
0
 public VariablesResponseType GetVariableInfoObject(string Variable, String authToken)
 {
     try
     {
         return(ODws.GetVariableInfo(Variable));
     }
     catch (Exception we)
     {
         log.Warn(we.Message);
         throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
     }
 }
Exemplo n.º 2
0
            public override TimeSeriesResponseTypeGeneric 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));
                    }


                    TimeSeriesResponseTypeObject res = (TimeSeriesResponseTypeObject)dvSvc.GetTimeSeries(lParam, vparam, startDt, endDt);

                    return(new xsd.TimeSeriesResponse(res));

                    //throw new NotImplementedException("Reimplement 1.1");
                }
                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);
                }
            }
Exemplo n.º 3
0
 public virtual SiteInfoResponseType GetSiteInfoObject(string SiteNumber, String authToken)
 {
     try
     {
         return(ODws.GetSiteInfo(SiteNumber));
     }
     catch (Exception we)
     {
         log.Warn(we.Message);
         throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
     }
 }
Exemplo n.º 4
0
            public SiteInfoResponseType GetSiteInfoMultpleObject(string[] site, string authToken)
            {
                GlobalClass.WaterAuth.SiteInfoServiceAllowed(Context, authToken);

                try
                {
                    return(ODws.GetSiteInfo(site, true));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }
Exemplo n.º 5
0
            public VariablesResponseType GetVariableInfoObject(string variable, String authToken)
            {
                GlobalClass.WaterAuth.VariableInfoServiceAllowed(Context, authToken);

                try
                {
                    return(ODws.GetVariableInfo(variable));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }
Exemplo n.º 6
0
        public virtual SiteInfoResponseType GetSiteInfoObject(string SiteNumber, String authToken)
        {
            GlobalClass.WaterAuth.SiteInfoServiceAllowed(Context, authToken);

            try
            {
                return(ODws.GetSiteInfo(SiteNumber));
            }
            catch (Exception we)
            {
                log.Warn(we.Message);
                throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
            }
        }
Exemplo n.º 7
0
            public string GetSourceObject(string[] source, String authToken)
            {
                GlobalClass.WaterAuth.SitesServiceAllowed(Context, authToken);

                try
                {
                    return("");//ODws.GetSites(source);
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }
Exemplo n.º 8
0
        public virtual TimeSeriesResponseType GetValuesObject(string locationParam, string VariableCode, 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"));
            }

            try
            {
                return(ODws.GetValues(locationParam, VariableCode, StartDate, EndDate));
            }
            catch (Exception we)
            {
                log.Warn(we.Message);
                throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
            }
        }
Exemplo n.º 9
0
            public override object GetSiteInfoObject(string site, String authToken)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

                queryLog2.LogStart(Logging.Methods.GetSiteInfo, site,
                                   Context.Request.UserHostName);

                try
                {
                    if (String.IsNullOrEmpty(site))
                    {
                        throw new WaterOneFlowException("Bad Location parameter submitted:'" +
                                                        site + "'");
                    }

                    List <locationParam> lParams = new List <locationParam>();
                    //foreach (String site in SiteNumbers)
                    //{
                    try
                    {
                        locationParam lp = new locationParam(site);
                        lParams.Add(lp);
                    }
                    catch
                    {
                        // only one here
                        log.Info("Bad Location parameter submitted:'" +
                                 site + "'");
                        throw new WaterOneFlowException("Bad Location parameter submitted:'" +
                                                        site + "'");
                    }
                    //}
                    if (lParams.Count > 0)
                    {
                        SiteInfoType[]       siteList = ODws.GetSites(lParams.ToArray());
                        SiteInfoResponseType sit      = new SiteInfoResponseType();
                        site[] sites = new site[siteList.Length];
                        // only one site
                        sites[0]          = new site();
                        sites[0].siteInfo = siteList[0];
                        // now add series
                        sites[0].seriesCatalog = ODws.GetSeries(lParams[0]);

                        sit.site = sites;
                        queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                         site,
                                         timer.ElapsedMilliseconds.ToString(),
                                         sit.site.Length.ToString(),
                                         Context.Request.UserHostName);

                        // add query info
                        if (sit.queryInfo == null)
                        {
                            sit.queryInfo = new QueryInfoType();
                        }
                        sit.queryInfo.creationTime          = DateTime.Now.ToLocalTime();
                        sit.queryInfo.creationTimeSpecified = true;
                        QueryInfoTypeCriteria crit = new QueryInfoTypeCriteria();
                        if (String.IsNullOrEmpty(site))
                        {
                            crit.locationParam = "none";
                        }
                        else
                        {
                            crit.locationParam = site;
                        }

                        sit.queryInfo.criteria = crit;

                        //return sit;
                        return(new WaterOneFlow.Service.v1_0.xsd.SiteInfoResponse(sit));
                    }
                    else
                    {
                        queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                         site,
                                         timer.ElapsedMilliseconds.ToString(),
                                         "-9999",
                                         Context.Request.UserHostName);
                        throw new WaterOneFlowException("No Valid Site Code submitted");
                    }
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    queryLog2.LogEnd(Logging.Methods.GetSiteInfo,
                                     site,
                                     timer.ElapsedMilliseconds.ToString(),
                                     "-9999",
                                     Context.Request.UserHostName);
                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }
Exemplo n.º 10
0
            public override object GetSites(
                [XmlArray("site"), XmlArrayItem("string", typeof(string))]
                string[] site,
                String authToken)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

                string siteListString;

                if (site != null)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (string s in site)
                    {
                        sb.AppendFormat("{0};", s);
                    }
                    siteListString = sb.ToString();
                }
                else
                {
                    siteListString = "All Sites";
                }

                queryLog2.LogStart(Logging.Methods.GetSites, siteListString,
                                   Context.Request.UserHostName);
                try
                {
                    List <locationParam> lParams             = new List <locationParam>();
                    StringBuilder        siteNumbersAsString = new StringBuilder();
                    if (site != null)
                    {
                        foreach (String s in site)
                        {
                            try
                            {
                                if (!String.IsNullOrEmpty(s))
                                {
                                    locationParam lp = new locationParam(s);
                                    lParams.Add(lp);
                                    siteNumbersAsString.AppendFormat("{0};", s);
                                }
                            }
                            catch
                            {
                                log.Info("Bad Location parameter submitted");
                            }
                        }
                    }
                    SiteInfoType[] siteList;
                    if (lParams.Count > 0)
                    {
                        siteList = ODws.GetSites(lParams.ToArray());
                    }
                    else
                    {
                        siteList = ODws.GetSites(null);
                    }

                    SiteInfoResponseType sit = new SiteInfoResponseType();
                    site[] sites             = new site[siteList.Length];
                    for (int i = 0; i < siteList.Length; i++)
                    {
                        sites[i]          = new site();
                        sites[i].siteInfo = siteList[i];
                    }
                    sit.site = sites;

                    queryLog2.LogEnd(Logging.Methods.GetSites,
                                     siteListString,
                                     timer.ElapsedMilliseconds.ToString(),
                                     sit.site.Length.ToString(),
                                     Context.Request.UserHostName);

                    // add query info
                    if (sit.queryInfo == null)
                    {
                        sit.queryInfo = new QueryInfoType();
                    }
                    sit.queryInfo.creationTime          = DateTime.Now.ToLocalTime();
                    sit.queryInfo.creationTimeSpecified = true;
                    QueryInfoTypeCriteria crit = new QueryInfoTypeCriteria();
                    if (site == null || site.Length == 0)
                    {
                        crit.locationParam = "ALL (empty request)";
                    }
                    else
                    {
                        crit.locationParam = siteNumbersAsString.ToString();
                    }

                    sit.queryInfo.criteria = crit;


                    // return sit;
                    return(new WaterOneFlow.Service.v1_0.xsd.SiteInfoResponse(sit));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);

                    queryLog2.LogEnd(Logging.Methods.GetSites,
                                     siteListString,
                                     timer.ElapsedMilliseconds.ToString(),
                                     "-9999",
                                     Context.Request.UserHostName
                                     );

                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }
Exemplo n.º 11
0
            public override 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);

                    /* Look to see if siates exist.
                     * NCDC sends back 200k for thier rest service.
                     * aka no errors, except as a string
                     * */
                    SiteInfoType site;
                    try
                    {
                        site = ODws.GetSiteInfoObject(lParam);

                        if (site == null)
                        {
                            throw new WaterOneFlowException("Unknown Site Code: '" + location + "'");
                        }
                    } catch (WaterOneFlowException wex)
                    {
                        throw new WaterOneFlowException("Unknown Site Code: '" + location + "'");
                    } catch (WaterOneFlowServerException wex)
                    {
                        log.Fatal("Database Error");
                        throw wex;
                    } catch (Exception ex)
                    {
                        log.Error("Unhandled Exception ", ex);
                        throw new WaterOneFlowServerException("Unhandled Error.");
                    }

                    VariableInfoType[] vars;
                    try
                    {
                        vars = ODws.GetVariableInfoObject(vparam);

                        if (vars.Length == 0)
                        {
                            throw new WaterOneFlowException("Unknown Variable Code: '" + variable + "'");
                        }
                    }
                    catch (WaterOneFlowException wex)
                    {
                        throw new WaterOneFlowException("Unknown Variable Code: '" + variable + "'");
                    }
                    catch (WaterOneFlowServerException wex)
                    {
                        log.Fatal("Database Error");
                        throw wex;
                    }
                    catch (Exception ex)
                    {
                        log.Error("Unhandled Exception ", ex);
                        throw new WaterOneFlowServerException("Unhandled Error.");
                    }

                    // moved date check after site and variable check
                    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));
                        int endDateMin = int.Parse(ConfigurationManager.AppSettings.Get("NCDCISD_EndDateMinYear"));
                        if (endDt.Value.DateTime.Year < endDateMin)
                        {
                            throw new WaterOneFlowException("NCDC ISD and ISH No Data is available before: " + endDateMin);
                        }
                    }

                    /***********************
                     * GET NCDC RESPONSE
                     * *********************
                     */
                    TimeSeriesResponseTypeObject res = (TimeSeriesResponseTypeObject)dvSvc.GetTimeSeries(lParam, vparam, startDt, endDt);


                    /***********************
                     * Add missing information from sites and variables db
                     * *********************
                     */
                    if (vars.Length > 0)
                    {
                        res.timeSeries.variable = vars[0];
                    }
                    if (site != null)
                    {
                        res.timeSeries.sourceInfo = site;
                    }


                    return(new WaterOneFlow.Service.v1_0.xsd.TimeSeriesResponse(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);
                }
            }
Exemplo n.º 12
0
            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);
                }
            }
Exemplo n.º 13
0
            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;
                    int           estimateCount = 0;
                    if (!String.IsNullOrEmpty(startDate))
                    {
                        startDt = new W3CDateTime(DateTime.Parse(startDate));
                    }
                    if (!String.IsNullOrEmpty(endDate))
                    {
                        endDt = new W3CDateTime(DateTime.Parse(endDate));
                    }

                    try
                    {
                        if (startDt.HasValue && endDt.HasValue)
                        {
                            estimateCount = (endDt.Value - startDt.Value).Hours * 4;
                            log.DebugFormat("{0}/{1}:estimated count: {2}", endDt.Value, startDt.Value, estimateCount);
                        }
                    }
                    catch
                    {
                    }
                    //               USGSwebService.TimeSeriesResponseType res =
                    //(USGSwebService.TimeSeriesResponseType)dvSvc.GetTimeSeries(lParam, vparam, startDt, endDt);
                    TimeSeriesResponseType res =
                        (TimeSeriesResponseType)dvSvc.GetTimeSeries(lParam, vparam, startDt, endDt);

                    if (res.timeSeries != null &&
                        res.timeSeries.values != null &&
                        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,
                                               estimateCount,
                                               Context.Request.UserHostName);
                    }

                    // return new NWISUVTimeSeriesResponse(res);// this one is an original class
                    TrackEvent(location, variable, startDate, endDate, estimateCount, Context);
                    return(new WaterOneFlow.Service.v1_0.xsd.TimeSeriesResponse(res));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    TrackEvent(location, variable, startDate, endDate, null, Context);
                    //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);
                }
            }
Exemplo n.º 14
0
            public SiteInfoResponseTypeGeneric GetSitesObject(string[] site, String authToken)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

                queryLog2.LogStart(Logging.Methods.GetSites, site.ToString(),
                                   Context.Request.UserHostName);
                try
                {
                    List <locationParam> lParams = new List <locationParam>();
                    foreach (String s in site)
                    {
                        try
                        {
                            if (!String.IsNullOrEmpty(s))
                            {
                                locationParam lp = new locationParam(s);
                                lParams.Add(lp);
                            }
                        }
                        catch
                        {
                            log.Info("Bad Location parameter submitted");
                        }
                    }
                    SiteInfoType[] siteList;
                    if (lParams.Count > 0)
                    {
                        siteList = ODws.GetSites(lParams.ToArray());
                    }
                    else
                    {
                        siteList = ODws.GetSites(null);
                    }
                    SiteInfoResponseType sit = new SiteInfoResponseType();
                    WaterOneFlow.Schema.v1_1.


                    SiteInfoResponseTypeSite[] sites = new SiteInfoResponseTypeSite[siteList.Length];
                    for (int i = 0; i < siteList.Length; i++)
                    {
                        sites[i]          = new SiteInfoResponseTypeSite();
                        sites[i].siteInfo = siteList[i];
                    }
                    sit.site = sites;

                    queryLog2.LogEnd(Logging.Methods.GetSites,
                                     site.ToString(),
                                     timer.ElapsedMilliseconds.ToString(),
                                     sit.site.Length.ToString(),
                                     Context.Request.UserHostName);

                    // add query info
                    if (sit.queryInfo == null)
                    {
                        sit.queryInfo = new QueryInfoType();
                    }
                    sit.queryInfo.creationTime          = DateTime.Now.ToLocalTime();
                    sit.queryInfo.creationTimeSpecified = true;
                    QueryInfoTypeCriteria crit = new QueryInfoTypeCriteria();
                    if (sites == null || sites.Length == 0)
                    {
                        crit.locationParam = "ALL (empty request)";
                    }
                    else
                    {
                        crit.locationParam = sites.ToString();
                    }

                    sit.queryInfo.criteria = crit;


                    return(new WaterOneFlow.Service.v1_1.xsd.SiteInfoResponse(sit));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);

                    queryLog2.LogEnd(Logging.Methods.GetSites,
                                     site.ToString(),
                                     timer.ElapsedMilliseconds.ToString(),
                                     "-9999",
                                     Context.Request.UserHostName
                                     );

                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }