webservice系列教學(17)-常式用到的wsdl檔案等

來源:互聯網
上載者:User
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" style="document" />
    <operation name="test">
      <soap:operation soapAction="http://tempuri.org/test" style="document" />
      <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>

相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。