'a WebService in VB.NET (calc_vb.asmx) <%@WebService Language="VB"class="Calc" %> Imports System.Web.Services Public Class Calc <WebMethod()> _ Public Function Add(ByVal a As Double, _ ByVal b As Double) As Double Return a + b End Function End Class
Imports System.Web.Services.Protocols '省略其他代码 Public Class Calc Inherits SoapHttpClientProtocol '省略其他代码 <System.Diagnostics.DebuggerStepThroughAttribute(),_ SoapDocumentMethodAttribute( _ "http://tempuri.org/Add", _ Use:=System.Web.Services.Description.SoapBindingUse.Literal,_ ParameterStyle:= SoapParameterStyle.Wrapped)>_ Public Function Add(ByVal a As Double, ByValb As Double) As Double Dim results() As Object = Me.Invoke("Add",_ New Object() {a, b}) Return CType(results(0), Double) End Function '省略其他代码 End Class