Example #1
0
            public override VariablesResponseTypeGeneric GetVariableInfoObject(string variable, String authToken)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

                queryLog2.LogStart(Logging.Methods.GetVariables, variable,
                                   Context.Request.UserHostName);

                try
                {
                    VariableParam[] vars = null;
                    if (!String.IsNullOrEmpty(variable))
                    {
                        vars = new VariableParam[1];

                        VariableParam vp = new VariableParam(variable);
                        vars[0] = vp;
                    }
                    VariablesResponseType res = ODws.GetVariables(vars);

                    // don't always have variables
                    if (res.variables != null)
                    {
                        queryLog2.LogEnd(Logging.Methods.GetVariables,
                                         variable,
                                         timer.ElapsedMilliseconds.ToString(),
                                         res.variables.Length.ToString(),
                                         Context.Request.UserHostName);
                    }
                    else
                    {
                        queryLog2.LogEnd(Logging.Methods.GetVariables,
                                         variable,
                                         timer.ElapsedMilliseconds.ToString(),
                                         "0",
                                         Context.Request.UserHostName);
                    }

                    return(new WaterOneFlow.Service.v1_1.xsd.VariablesResponse(res));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    queryLog2.LogEnd(Logging.Methods.GetVariables,
                                     variable,
                                     timer.ElapsedMilliseconds.ToString(),
                                     "-9999",
                                     Context.Request.UserHostName);

                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }
Example #2
0
            public override object GetVariableInfoObject(string variable, String authToken)
            {
                Stopwatch timer = System.Diagnostics.Stopwatch.StartNew();

                queryLog2.LogStart(Logging.Methods.GetVariables, variable,
                                   Context.Request.UserHostName);

                try
                {
                    VariableParam[] vars = null;
                    if (!String.IsNullOrEmpty(variable))
                    {
                        vars = new VariableParam[1];

                        VariableParam vp = new VariableParam(variable);
                        vars[0] = vp;
                    }
                    VariablesResponseType res = ODws.GetVariables(vars);

                    // don't always have variables
                    if (res.variables != null)
                    {
                        queryLog2.LogEnd(Logging.Methods.GetVariables,
                                         variable,
                                         timer.ElapsedMilliseconds.ToString(),
                                         res.variables.Length.ToString(),
                                         Context.Request.UserHostName);
                    }
                    else
                    {
                        queryLog2.LogEnd(Logging.Methods.GetVariables,
                                         variable,
                                         timer.ElapsedMilliseconds.ToString(),
                                         "0",
                                         Context.Request.UserHostName);
                    }
                    WaterOneFlow.Service.v1_0.xsd.VariablesResponse obj =
                        new WaterOneFlow.Service.v1_0.xsd.VariablesResponse(res);
                    // if (DEBUG) {
                    // XmlSerializer xs = new XmlSerializer(
                    //     typeof (WaterOneFlow.Service.v1_0.xsd.VariablesResponse));
                    // StringBuilder sb = new StringBuilder();
                    // XmlWriterSettings settings = new XmlWriterSettings();

                    // settings.OmitXmlDeclaration = true;
                    //// settings.ConformanceLevel = ConformanceLevel.Fragment;
                    // XmlWriter writer = XmlWriter.Create(sb, settings);
                    // xs.Serialize(writer, obj);
                    //}
                    //return res;
                    return(new WaterOneFlow.Service.v1_0.xsd.VariablesResponse(res));
                }
                catch (Exception we)
                {
                    log.Warn(we.Message);
                    queryLog2.LogEnd(Logging.Methods.GetVariables,
                                     variable,
                                     timer.ElapsedMilliseconds.ToString(),
                                     "-9999",
                                     Context.Request.UserHostName);

                    throw SoapExceptionGenerator.WOFExceptionToSoapException(we);
                }
            }