日期:2011-04-10  浏览次数:20447 次

4. 5使用C#调用
无需下载任何组件
新建项目Visual C#项目windows应用程序。
在解决方案资源管理器中添加web引用,输入wsdl文件所在地址。
将web引用改名.
yundan.(service_name)即可引用
*需引用System.web.services*
例程:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace csharp
{
        public class Form1 : System.Windows.Forms.Form
        {
            private System.Windows.Forms.Label label1;
            private System.Windows.Forms.TextBox textBox1;
            private System.ComponentModel.Container components = null;
            public Form1()
            {
                InitializeComponent();
            }
            protected override void Dispose( bool disposing )
            {
                if( disposing )
                {
                    if (components != null)
                    {
                        components.Dispose();
                    }
                }
                base.Dispose( disposing );
            }
            #region Windows Form Designer generated code
            private void InitializeComponent()
            {
                this.label1 = new System.Windows.Forms.Label();
                this.textBox1 = new System.Windows.Forms.TextBox();
                this.SuspendLayout();
                this.label1.AutoSize = true;
                this.label1.Location = new System.Drawing.Point(88, 48);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(91, 14);