wstest.cs
来自「Web Service测试小工具(包含源代码) Web Service相信大」· CS 代码 · 共 65 行
CS
65 行
/*
* 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 + =
减小字号Ctrl + -
显示快捷键?