Exemple #1
0
        //:::::::::::::::::::::::::::::::::

        static public List <ServiceHost> LoadWebServices(string inConfigFilename)
        {
            try
            {
                return(LoadWebServicesFromXML(ServiceInfo.GetXMLDocFromFile(inConfigFilename)));
            }
            catch (System.Xml.XmlException xe)
            {
                string message = String.Format("Error loading Menumate.WinServices config file: {0} (problem with XML format?)", inConfigFilename);
                ServiceLogger.LogException(message, xe);

                return(defaultWebService());
            }
            catch (Exception e)
            {
                ServiceLogger.LogException("Error loading Menumate.WinServices config file", e);

                return(defaultWebService());
            }
        }
Exemple #2
0
        //:::::::::::::::::::::::::::::::::

        static public List <ServiceHost> LoadWebServicesFromXML(XmlDocument inDoc)
        {
            List <ServiceHost> result = new List <ServiceHost>();

            //::::::::::::::::::::::::::::::::::::::

            XmlNodeList serviceNodeList = null;
            string      serviceName     = "";

            serviceNodeList = inDoc.DocumentElement.SelectNodes("WebServices/WebService");

            foreach (XmlNode serviceNode in serviceNodeList)
            {
                serviceName = serviceNode.Attributes["name"].Value;

                try
                {
                    string loadThisService = serviceNode.Attributes["load"].Value;

                    if (loadThisService.ToUpper() == @"YES")
                    {
                        result.Add(LoadWebService(strToServiceID(serviceNode.Attributes["id"].Value)));
                        ServiceLogger.Log(String.Format(@"Web Service {0} created.", serviceName));
                    }
                }
                catch (Exception e)
                {
                    ServiceLogger.LogException(String.Format(@"Error loading Web Service {0}. Does this file really exist?", serviceName), e);
                }
            }

            if (result.Count == 0)
            {
                //result.Add(new ServiceBase());
                ServiceLogger.Log(@"No Menumate Web Services to be loaded.");
            }

            return(result);
        }