private object InvokeWebMethod(MethodInfo method, object[] parameters)
        {
            HttpWebClientProtocol proxy = WsdlModel.Proxy;
            object result = null;
            RequestProperties properties = new RequestProperties(proxy);
            try
            {
                Type declaringType = method.DeclaringType;
                WSSWebRequest.RequestTrace = properties;
                result = method.Invoke(proxy, BindingFlags.Public, null, parameters, null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                WSSWebRequest.RequestTrace = null;
                InvokeComplete(this, new InvokeCompleteEventArgs(method, properties, result));
            }

            return result;
        }
 public void Update(RequestProperties properties)
 {
     requestTextBox.Content = properties.requestPayLoad;
     responseTextBox.Content = properties.responsePayLoad;
 }
        private void cmenuInuptTree_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Text == "SaveInput")
            {
                XmlDocument xmlDocument = new XmlDocument();
                MethodProperty property1 = GetCurrentMethodProperty();
                if (property1 != null)
                {
                    HttpWebClientProtocol protocol1 = property1.GetProxyProperty().GetProxy();
                    RequestProperties properties1 = new RequestProperties(protocol1);
                    try
                    {
                        WSSWebRequest.RequestTrace = properties1;
                        XmlCongifManager.ReadConfig(treeInput.Nodes[0], null, ref xmlDocument);
                    }
                    finally
                    {
                        WSSWebRequest.RequestTrace = null;
                        propRequest.SelectedObject = properties1;
                        richRequest.Text = properties1.requestPayLoad;
                        richResponse.Text = properties1.responsePayLoad;
                    }
                }

                if (property1 != null)
                {
                    Stream myStream = null;

                    saveFileDialog1.Filter = "xml files (*.xml)|*.xml";
                    saveFileDialog1.FilterIndex = 2;
                    saveFileDialog1.RestoreDirectory = true;

                    if (Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != String.Empty &&
                        Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != null)
                    {
                        saveFileDialog1.InitialDirectory =
                            Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath;
                    }

                    saveFileDialog1.FileName = treeInput.Nodes[0].Tag.ToString();

                    cmenuInputTree.Close();

                    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        if ((myStream = saveFileDialog1.OpenFile()) != null)
                        {
                            StreamWriter wText = new StreamWriter(myStream);

                            wText.Write(XmlCongifManager.FormatXmlDocumentToString(xmlDocument));
                            wText.Flush();
                            myStream.Close();
                        }
                    }
                }
            }
            else if (e.ClickedItem.Text == "LoadInput")
            {
                Stream myStream = null;

                openFileDialog1.Filter = "xml files (*.xml)|*.xml";
                openFileDialog1.FilterIndex = 2;
                openFileDialog1.RestoreDirectory = true;

                if (Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != String.Empty &&
                    Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath != null)
                {
                    openFileDialog1.InitialDirectory = Configuration.MasterConfig.OtherSettings.DefaultConfigFilePath;
                }

                cmenuInputTree.Close();

                XmlDocument xmlDocument = new XmlDocument();
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        xmlDocument.Load(myStream);
                        myStream.Close();
                    }
                }

                if (treeMethods.Nodes.Count > 0)
                {
                    if (xmlDocument.ChildNodes.Count > 0)
                    {
                        OuterRunHelper.ClickNode(mainForm.treeMethods, mainForm.treeMethods.Nodes[0],
                                                 xmlDocument.ChildNodes[0].Name, mainForm);
                    }
                }

                if (treeInput.Nodes.Count > 0)
                {
                    XmlCongifManager.ApplyConfig(treeInput.Nodes[0], String.Empty, xmlDocument, wsdl.ProxyAssembly);
                }
            }
            else if (e.ClickedItem.Text == "Find")
            {
                FindForm findForm = new FindForm();
                findForm.ShowDialog();

                if (findForm.DialogResult == DialogResult.OK)
                {
                    if (treeInput.Nodes != null && treeInput.Nodes.Count > 0)
                        SelectNode(treeInput, treeInput.Nodes[0], findForm.FindValue);
                }
            }
            else if (e.ClickedItem.Text == "LoadValueField")
            {
                if (btnStart.Text == "Stop")
                {
                    TreeNode node = treeInput.SelectedNode;
                    ValueFieldsForm valueFieldsForm = new ValueFieldsForm();
                    valueFieldsForm.ShowDialog();
                    BatchRunCongifFileHelper.RunParameter(valueFieldsForm.SelectVauleField,
                                                          TreeNodeToXPath(node.FullPath),
                                                          treeMethods.SelectedNode.Text,
                                                          treeMethods.SelectedNode.Text + ".xml");
                }
            }
        }
        private void InvokeWebMethod()
        {
            MethodProperty property1 = GetCurrentMethodProperty();
            if (property1 != null)
            {
                HttpWebClientProtocol protocol1 = property1.GetProxyProperty().GetProxy();
                RequestProperties properties1 = new RequestProperties(protocol1);
                try
                {
                    MethodInfo info1 = property1.GetMethod();
                    //Type type1 = info1.DeclaringType;
                    WSSWebRequest.RequestTrace = properties1;
                    object[] objArray1 = property1.ReadChildren() as object[];
                    object obj1 = info1.Invoke(protocol1, BindingFlags.Public, null, objArray1, null);
                    treeOutput.Nodes.Clear();
                    MethodProperty property2 = new MethodProperty(property1.GetProxyProperty(), info1, obj1, objArray1);
                    property2.RecreateSubtree(null);
                    treeOutput.Nodes.Add(property2.TreeNode);

                    if (!chkCollapse.Checked)
                        treeOutput.ExpandAll();

                    if (treeOutput.Nodes.Count > 0)
                    {
                        this.RemoveSpecifiedFieldsRecursively(treeOutput.Nodes[0]);
                        this.AddIconRecursively(treeOutput.Nodes[0]);
                    }

                }
                finally
                {
                    WSSWebRequest.RequestTrace = null;
                    propRequest.SelectedObject = properties1;
                    richRequest.Text = properties1.requestPayLoad;
                    richResponse.Text = properties1.responsePayLoad;
                }
            }
        }
Esempio n. 5
0
 private void InvokeWebMethod()
 {
     MethodProperty currentMethodProperty = this.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);
             this.treeOutput.Nodes.Clear();
             MethodProperty property2 = new MethodProperty(currentMethodProperty.GetProxyProperty(), method, result, parameters);
             property2.RecreateSubtree(null);
             this.treeOutput.Nodes.Add(property2.TreeNode);
             this.treeOutput.ExpandAll();
         }
         finally
         {
             WSSWebRequest.RequestTrace = null;
             this.propRequest.SelectedObject = properties;
             this.richRequest.Text = properties.requestPayLoad;
             this.richResponse.Text = properties.responsePayLoad;
         }
     }
 }
 public InvokeCompleteEventArgs(MethodInfo method, RequestProperties properties, object result)
 {
     Method = method;
     RequestProperties = properties;
     Result = result;
 }