日期:2008-10-23  浏览次数:20371 次

《Service1.asmx》
<%@ WebService Language="vb" Codebehind="Service1.asmx.vb" Class="yundan.Service1" %>
《Service1.asmx.vb》
Imports System.Web.Services
<WebService(Namespace := "http://tempuri.org/")> _
Public Class Service1
    Inherits System.Web.Services.WebService
#Region " Web 服务设计器生成的代码 "

    Public Sub New()
        MyBase.New()

        '该调用是 Web 服务设计器所必需的。
        InitializeComponent()

        '在 InitializeComponent() 调用之后添加您自己的初始化代码

    End Sub

    'Web 服务设计器所必需的
    Private components As System.ComponentModel.IContainer

    '注意:以下过程是 Web 服务设计器所必需的
    '可以使用 Web 服务设计器修改此过程。
    '不要使用代码编辑器修改它。
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
    End Sub

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        'CODEGEN: 此过程是 Web 服务设计器所必需的
        '不要使用代码编辑器修改它。
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

#End Region
<WebMethod()> Public Function test(ByVal a As Integer, ByVal b As Integer) As Integer
        Return a + b
    End Function
end class
《Service1.wsdl》
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:s0="http://tempuri.org/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://tempuri.org/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
      <s:element name="test">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int" />
            <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int" />
          </s:sequence>
        </s:complexType>
      <s:eleme