webservice系列教学(17)-例程用到的wsdl文件等

80酷酷网    80kuku.com

  web《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:element name="string" nillable="true" type="s:string" />
      <s:element name="ArrayOfString" nillable="true" type="s0:ArrayOfString" />
      <s:element name="boolean" type="s:boolean" />
      <s:element name="int" type="s:int" />
  <message name="testSoapIn">
    <part name="parameters" element="s0:test" />
  </message>
  <message name="testSoapOut">
    <part name="parameters" element="s0:testResponse" />
  </message>
  <message name="testHttpGetIn">
    <part name="a" type="s:string" />
    <part name="b" type="s:string" />
  </message>
  <message name="testHttpGetOut">
    <part name="Body" element="s0:int" />
  </message>
  <message name="testHttpPostIn">
    <part name="a" type="s:string" />
    <part name="b" type="s:string" />
  </message>
  <message name="testHttpPostOut">
    <part name="Body" element="s0:int" />
  </message>
    <operation name="test">
      <input message="s0:testSoapIn" />
      <output message="s0:testSoapOut" />
    </operation>
<portType name="Service1HttpGet">
    <operation name="test">
      <input message="s0:testHttpGetIn" />
      <output message="s0:testHttpGetOut" />
    </operation>
</portType>
<portType name="Service1HttpPost">
    <operation name="test">
      <input message="s0:testHttpPostIn" />
      <output message="s0:testHttpPostOut" />
    </operation>
  </portType>
<binding name="Service1Soap" type="s0:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="test">
      <soap:operation soapAction="http://tempuri.org/test" />
      <input>
        <soap:body use="literal" />
      </input>
      <output>
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
  <binding name="Service1HttpGet" type="s0:Service1HttpGet">
    <http:binding verb="GET" />
  <operation name="test">
      <http:operation location="/test" />
      <input>
        <http:urlEncoded />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
  </binding>
<binding name="Service1HttpPost" type="s0:Service1HttpPost">
    <http:binding verb="POST" />
    <operation name="test">
      <http:operation location="/test" />
      <input>
        <mime:content type="application/x-www-form-urlencoded" />
      </input>
      <output>
        <mime:mimeXml part="Body" />
      </output>
    </operation>
  </binding>
  <service name="Service1">
    <port name="Service1Soap" binding="s0:Service1Soap">
      <soap:address location="http://192.168.0.4/yundan/Service1.asmx" />
    </port>
    <port name="Service1HttpGet" binding="s0:Service1HttpGet">
      <http:address location="http://192.168.0.4/yundan/Service1.asmx" />
    </port>
    <port name="Service1HttpPost" binding="s0:Service1HttpPost">
      <http:address location="http://192.168.0.4/yundan/Service1.asmx" />
    </port>
  </service>
</definitions>

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: