Example #1
0
        private CodeExpression BuildProxy(CodeStatementCollection statements, MethodInfo method)
        {
            Type   type = this.proxy.GetType();
            string name = CodeIdentifier.MakeCamel(type.Name);

            if (this.proxySetting == ProxySettings.AllProperties)
            {
                return(this.BuildClass(statements, name, this.proxy));
            }
            CodeVariableDeclarationStatement statement = new CodeVariableDeclarationStatement(type.Name, name);

            statement.InitExpression = new CodeObjectCreateExpression(type.FullName, new CodeExpression[0]);
            statements.Add(statement);
            CodeExpression targetObject = new CodeVariableReferenceExpression(name);

            FieldInfo[] soapHeaders = null;
            if (this.proxySetting == ProxySettings.RequiredHeaders)
            {
                soapHeaders = MethodProperty.GetSoapHeaders(method, true);
            }
            else
            {
                soapHeaders = type.GetFields();
            }
            for (int i = 0; i < soapHeaders.Length; i++)
            {
                FieldInfo info = soapHeaders[i];
                if (typeof(SoapHeader).IsAssignableFrom(info.FieldType))
                {
                    CodeExpression left  = new CodeFieldReferenceExpression(targetObject, info.Name);
                    CodeExpression right = this.BuildObject(statements, info.Name, info.GetValue(this.proxy));
                    statements.Add(new CodeAssignStatement(left, right));
                }
            }
            return(targetObject);
        }
Example #2
0
        private CodeExpression BuildProxy(CodeStatementCollection statements, MethodInfo method)
        {
            Type   type1 = proxy.GetType();
            string text1 = CodeIdentifier.MakeCamel(type1.Name);

            if (proxySetting == ProxySettings.AllProperties)
            {
                return(BuildClass(statements, text1, proxy));
            }
            CodeVariableDeclarationStatement statement1 = new CodeVariableDeclarationStatement(type1.Name, text1);

            statement1.InitExpression = new CodeObjectCreateExpression(type1.FullName, new CodeExpression[0]);
            statements.Add(statement1);
            CodeExpression expression1 = new CodeVariableReferenceExpression(text1);

            FieldInfo[] infoArray1 = null;
            if (proxySetting == ProxySettings.RequiredHeaders)
            {
                infoArray1 = MethodProperty.GetSoapHeaders(method, true);
            }
            else
            {
                infoArray1 = type1.GetFields();
            }
            for (int num1 = 0; num1 < infoArray1.Length; num1++)
            {
                FieldInfo info1 = infoArray1[num1];
                if (typeof(SoapHeader).IsAssignableFrom(info1.FieldType))
                {
                    CodeExpression expression2 = new CodeFieldReferenceExpression(expression1, info1.Name);
                    CodeExpression expression3 = BuildObject(statements, info1.Name, info1.GetValue(proxy));
                    statements.Add(new CodeAssignStatement(expression2, expression3));
                }
            }
            return(expression1);
        }
        public void treeMethods_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Tag is MethodInfo)
            {
                MethodInfo info1 = e.Node.Tag as MethodInfo;
                treeInput.Nodes.Clear();
                MethodProperty property1 = new MethodProperty(GetProxyPropertyFromNode(e.Node), info1);
                property1.RecreateSubtree(null);
                treeInput.Nodes.Add(property1.TreeNode);
                if (!OutCall)
                {
                    e.Node.Tag = property1.TreeNode;
                }

                XmlCongifManager.ApplyDefaultConfig(treeInput.Nodes[0]);
            }
            else if (e.Node.Tag is TreeNode)
            {
                treeInput.Nodes.Clear();
                treeInput.Nodes.Add((TreeNode)e.Node.Tag);
            }
            treeInput.ExpandAll();
            treeInput.SelectedNode = treeInput.Nodes[0];

            if (treeInput.Nodes.Count > 0)
                this.AddIconRecursively(treeInput.Nodes[0]);
        }
        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;
                }
            }
        }
Example #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;
         }
     }
 }
Example #6
0
 private void treeMethods_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.Tag is MethodInfo)
     {
         MethodInfo tag = e.Node.Tag as MethodInfo;
         this.treeInput.Nodes.Clear();
         MethodProperty property = new MethodProperty(this.GetProxyPropertyFromNode(e.Node), tag);
         property.RecreateSubtree(null);
         this.treeInput.Nodes.Add(property.TreeNode);
         e.Node.Tag = property.TreeNode;
     }
     else if (e.Node.Tag is TreeNode)
     {
         this.treeInput.Nodes.Clear();
         this.treeInput.Nodes.Add((TreeNode) e.Node.Tag);
     }
     this.treeInput.ExpandAll();
     this.treeInput.SelectedNode = this.treeInput.Nodes[0];
 }