public static void CreateConfig(string filename, TreeNode selectNode) { if (!xmlDocumens.ContainsKey(filename)) { XmlDocument xmlDocument = new XmlDocument(); XmlCongifManager.ReadConfig(selectNode, null, ref xmlDocument); xmlDocumens.Add(filename, xmlDocument); } }
/// <summary> /// /// </summary> /// <param name="method"></param> /// <param name="xmlDocument"></param> /// <param name="mainForm"></param> /// <returns></returns> public static XmlDocument InvokeMethod(string method, XmlDocument xmlDocument, MainForm mainForm) { #region Check Input if (method == null || method == String.Empty) { throw new Exception("Method not allow empty!"); } if (xmlDocument == null) { throw new Exception("Config File not allow empty!"); } if (mainForm == null) { throw new Exception("MainForm not allow null!"); } #endregion #region write log Console.WriteLine(String.Format("WSDL EndPoint:{0}", mainForm.wsdl.Paths[0])); Console.WriteLine(String.Format("Method: {0} ", method)); Console.WriteLine(String.Format("ConfigFile: \r\n {0}", XmlCongifManager.FormatXmlDocumentToString(xmlDocument))); #endregion if (mainForm.treeMethods.Nodes.Count == 0) { throw new Exception("Can not get method tree ,please check asm path."); } lock (locker) { ClickNode(mainForm.treeMethods, mainForm.treeMethods.Nodes[0], method, mainForm); if (mainForm.treeInput.Nodes.Count == 0) { throw new Exception(String.Format("Not exist method named {0} in endpoint {1}", method, mainForm.textEndPointUri.Text)); } XmlCongifManager.ApplyConfig(mainForm.treeInput.Nodes[0], String.Empty, xmlDocument, mainForm.wsdl.ProxyAssembly); mainForm.buttonInvoke_Click(null, null); XmlDocument xmlDocument1 = new XmlDocument(); if (mainForm.treeOutput.Nodes[0].Nodes[1].Nodes.Count > 0) { TreeNode outPutNode = mainForm.treeOutput.Nodes[0].Nodes[1].Nodes[0]; XmlCongifManager.ReadOutput(outPutNode, null, ref xmlDocument1); } return(xmlDocument1); } }