private void InvokeWebMethod() { MethodProperty currentMethodProperty = GetCurrentMethodProperty(); if (currentMethodProperty != null) { HttpWebClientProtocol proxy = currentMethodProperty.GetProxyProperty().GetProxy(); RequestProperties properties = new RequestProperties(proxy); try { MethodInfo method = currentMethodProperty.GetMethod(); System.Type declaringType = method.DeclaringType; WSSWebRequest.RequestTrace = properties; object[] parameters = currentMethodProperty.ReadChildren() as object[]; object result = method.Invoke(proxy, BindingFlags.Public, null, parameters, null); treeOutput.Nodes.Clear(); MethodProperty property2 = new MethodProperty(currentMethodProperty.GetProxyProperty(), method, result, parameters); property2.RecreateSubtree(null); treeOutput.Nodes.Add(property2.TreeNode); treeOutput.ExpandAll(); } finally { WSSWebRequest.RequestTrace = null; propRequest.SelectedObject = properties; richRequest.Text = properties.requestPayLoad; richResponse.Text = properties.responsePayLoad; } } }
private MethodProperty GetCurrentMethodProperty() { if ((this.treeInput.Nodes == null) || (treeInput.Nodes.Count == 0)) { MessageBox.Show(this, "Select a web method to execute"); return(null); } TreeNode node = treeInput.Nodes[0]; MethodProperty tag = node.Tag as MethodProperty; if (tag == null) { MessageBox.Show(this, "Select a method to execute"); return(null); } return(tag); }
private void treeMethods_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node.Tag is MethodInfo) { MethodInfo tag = e.Node.Tag as MethodInfo; treeInput.Nodes.Clear(); MethodProperty property = new MethodProperty(GetProxyPropertyFromNode(e.Node), tag); property.RecreateSubtree(null); treeInput.Nodes.Add(property.TreeNode); e.Node.Tag = property.TreeNode; } else if (e.Node.Tag is TreeNode) { treeInput.Nodes.Clear(); treeInput.Nodes.Add((TreeNode)e.Node.Tag); } treeInput.ExpandAll(); treeInput.SelectedNode = treeInput.Nodes[0]; }
private string GenerateClientCode() { Script script = new Script(wsdl.ProxyNamespace, "MainClass"); foreach (TreeNode node in treeMethods.Nodes) { script.Proxy = GetProxyPropertyFromNode(node).GetProxy(); foreach (TreeNode node2 in node.Nodes) { TreeNode tag = node2.Tag as TreeNode; if (tag != null) { MethodProperty property = tag.Tag as MethodProperty; if (property != null) { MethodInfo method = property.GetMethod(); object[] parameters = property.ReadChildren() as object[]; script.AddMethod(method, parameters); } } } } return(script.Generate(this.wsdl.GetCodeGenerator)); }
set => SetValue(MethodProperty, value);