⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wstest.cs

📁 Web Service测试小工具(包含源代码) Web Service相信大家都很熟悉
💻 CS
字号:
/*
 * Author : 方伍
 * Date: 2008-2-21
 * Blog: http://www.cnblogs.com/binbin1845
 * QQ: 32418201
 * Email: binbin1845@126.com
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WSTest
{
    public partial class WSTest : Form
    {
        public WSTest()
        {
            InitializeComponent();
            cmbAddress.Items.Add("http://localhost/EWS.UI.Service/EWSService.asmx");
            cmbAddress.Items.Add("http://localhost/YEA.COMOD.EWS.Service/EWSService.asmx");
        }

        private void btnTest_Click(object sender, EventArgs e)
        {
            try
            {
                string wsAddress = cmbAddress.Text.Trim();
                string wsMethod = txtMethod.Text.Trim();
                object[] wsParameter = null;
                if (txtParameter.Text.Trim() != "")
                {
                    wsParameter = txtParameter.Text.Trim().Split(',');
                }
                object result = WebServiceHelper.InvokeWebService(wsAddress, wsMethod, wsParameter);
                if (result == null)
                {
                    txtResult.Text = "null";
                    dgResult.DataSource = null;
                    return;
                }
                if (result.GetType().FullName == "System.Data.DataSet")
                {
                    DataSet ds = (DataSet)result;
                    dgResult.DataSource = ds.Tables[0].DefaultView;
                    txtResult.Text = "";
                }
                else
                {
                    txtResult.Text = result.ToString();
                    dgResult.DataSource = null;
                }

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -