webservice系列教學(8)-如何調(diào)用webservice(vb.net) [ English ]
2008-2-24 1:50:31 中國學網(wǎng) 跟貼 0 條 網(wǎng)友投稿
4.7使用vb.net調(diào)用
無需下載任何組件
新建?項目?Visual Basic項目?windows應用程序。
在解決方案資源管理器中添加web引用,輸入wsdl文件所在地址。
將web引用改名為yundan.
yundan.(service_name)即可引用
*需引用System.web.services*
例程:
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗體設計器生成的代碼 "
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
Private components As System.ComponentModel.IContainer
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(96, 40)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(91, 14)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Webservice演示"
Me.TextBox1.Location = New System.Drawing.Point(88, 144)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = "TextBox1"
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Label1})
Me.Name = "Form1"
Me.Text = "VB.net webserive演示"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim cc As yundan.Service1 = New yundan.Service1()
TextBox1.Text = cc.test(12, 123)
End Sub
End Class 轉帖于 Xue163.com_VB.NET
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內(nèi)容,請
點擊舉報。