Esempio n. 1
0
        private void GetDescription()
        {
            if (SCPD == null)
                return;

            WebRequest request = WebRequest.Create(SCPD);

            XmlDocument doc = new XmlDocument();

            doc.Load(request.GetResponse().GetResponseStream());

            foreach (XmlNode node in doc.SelectNodes("/*[local-name()='scpd']/*[local-name()='actionList']/*[local-name()='action']"))
            {
                ServiceAction action = new ServiceAction(node.SelectSingleNode("*[local-name()='name']/text()").Value, Protocol);
                foreach (XmlNode argumentNode in node.SelectNodes("*[local-name()='argumentList']/*[local-name()='argument']"))
                {
                    string argumentName = argumentNode.SelectSingleNode("*[local-name()='name']/text()").Value;
                    string argumentType = argumentNode.SelectSingleNode("*[local-name()='relatedStateVariable']/text()").Value;
                    if (!ArgumentType.IsArgumentType(argumentType))
                        argumentType = doc.SelectSingleNode("/*[local-name()='scpd']/*[local-name()='serviceStateTable']/*[local-name()='stateVariable' and ./*[local-name()='name']/text()='" + argumentType + "']/*[local-name()='dataType']/text()").Value;
                    action.Add(new ServiceActionArgument<string>(argumentName, argumentType, argumentNode.SelectSingleNode("*[local-name()='direction']/text()").Value));
                }
                actions.Add(action.Name, action);
            }
        }