private void RunFunction()
        {
            SiebelWrapper sw = new SiebelWrapper();

            SiebelWrapper.PropertySet ips = new SiebelWrapper.PropertySet();
            SiebelAnswer answer;

            GetPs(ref ips, tvIps.Nodes[0], false);

            //ops = sw.InvokeMethod(txtService.Text, txtFunction.Text, ips);
            answer = sw.InvokeMethod(txtService.Text, txtFunction.Text, ips.GetChild(0));

            tvOps.Nodes[0].Nodes.Clear();
            (new SiebProperty("", "", SiebProperty.PropertyType.PropertySet)).ToTreeNode(tvOps.Nodes[0]);
            tvLog.Nodes[0].Nodes.Clear();
            SetPs(tvLog.Nodes[0], answer.InvokeMethodResult);
            tvLog.ExpandAll();

            if (answer.IsError)
            {
                MessageBox.Show(answer.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                SetPs(tvOps.Nodes[0], answer.FunctionResult);
                tvOps.ExpandAll();
                txtService.AutoCompleteCustomSource.Add(txtService.Text);
                txtFunction.AutoCompleteCustomSource.Add(txtFunction.Text);
            }
        }
/// <summary>
/// return xml document, it contain bsName, function name and ips,
/// </summary>
/// <returns></returns>
        private XmlDocument SaveContextToXML()
        {
            XmlDocument doc = new XmlDocument();
            XmlNode     n   = doc.CreateElement("RunBS");

            SiebelWrapper.PropertySet ips = new SiebelWrapper.PropertySet();

            XmlNode attr = doc.CreateAttribute("BsName");

            attr.Value = this.txtService.Text;
            n.Attributes.SetNamedItem(attr);

            attr       = doc.CreateAttribute("BsFunction");
            attr.Value = this.txtFunction.Text;
            n.Attributes.SetNamedItem(attr);

            SiebelWrapper sw = new SiebelWrapper();

            GetPs(ref ips, tvIps.Nodes[0], false);
            string xmlStr = sw.PsToXml(ips);

            XmlDocument resp = new XmlDocument();

            resp.LoadXml(xmlStr);

            attr = doc.CreateElement("PS");

            //attr.InnerXml = resp.DocumentElement.InnerXml;
            attr.InnerXml = resp.DocumentElement.OuterXml;
            n.AppendChild(attr);

            doc.AppendChild(n);
            return(doc);
        }
        private void SetPs(TreeNode t, string Xml)
        {
            SiebelWrapper sw = new SiebelWrapper();

            SiebelWrapper.PropertySet ps = sw.PsFromXml(Xml);


            //string xmlStr = sw.PsToXml(ips);
        }