zoukankan      html  css  js  c++  java
  • 一个完整的WSDL文档及各标签详解

    <?xml version="1.0" encoding="UTF8" ?>

    <wsdl:definitions targetNamespace="http://www.57market.com.cn/HelloService" xmlns:soapenc12="http://www.w3.org/2003/05/soapencoding" xmlns:tns="http://www.57market.com.cn/HelloService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soapenvelope">

     

    /**

     * type元素,定义了交换信息的数据格式。

     * 为了实现最大的互操作性(interoperability)和平台中立性(neutrality),WSDL选用XML Schema DataTypes

     * 简称XSD作为标准类型系统,并将它作为固有类型系统。

     * 下面是数据定义部分,该部分定义了两个元素,一个是sayHello,一个是sayHelloResponse:

     * sayHello:定义了一个复杂类型,仅仅包含一个简单的字符串,将来用来描述操作的参入传入部分;

     * sayHelloResponse:定义了一个复杂类型,仅仅包含一个简单的字符串,将来用来描述操作的返回值;

     */

    <wsdl:types>

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://www.57market.com.cn/HelloService">

           

           <xsd:element name="sayHello">

      <xsd:complexType>

    <xsd:sequence>

      <xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string" />

      </xsd:sequence>

      </xsd:complexType>

    </xsd:element>

     

    <xsd:element name="sayHelloResponse">

    <xsd:complexType>

     <xsd:sequence>

      <xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="xsd:string" />

      </xsd:sequence>

         </xsd:complexType>

      </xsd:element>

     

      </xsd:schema>

      </wsdl:types>

     

    /**

     * message元素指定XML 数据类型组成消息的各个部分。message元素用于定义操作的输入和输出参数。

     * 该部分是信息格式的抽象定义:定义了两个消息sayHelloResponse和sayHelloRequest:

     * sayHelloRequest:sayHello操作的请求消息格式,由一个消息片断组成,名字为parameters,

     * 元素是我们前面定义的 types中的元素;

     * sayHelloResponse:sayHello操作的响应消息格式,由一个消息片断组成,名字为parameters,

     * 元素是我们前面定义 *的types中的元素;

     * 如果采用RPC样式的消息传递,只需要将文档中的element元素应以修改为type即可。

    *message:用來定義消息的結構

    *part:指定引用types中定義的標籤片斷

     */

    <wsdl:message name="sayHelloRequest">

         <wsdl:part name="parameters" element="tns:sayHello" />

     </wsdl:message>

     

    <wsdl:message name="sayHelloResponse">

         <wsdl:part name="parameters" element="tns:sayHelloResponse" />

     </wsdl:message>

     

    /**

     * portType元素中定义了Web服务的操作。操作定义了输入和输出数据流中可以出现的XML消息。

     * 一些抽象操作的集合。每个操作关联一个输入消息和一个输出消息。

     * portType定义了服务的调用模式的类型,这里包含一个操作sayHello方法,同时包含input和output表明

     * 该操作是一个 请求/响应模式,请求消息是前面定义的sayHelloRequest,

     * 响应消息是前面定义的 sayHelloResponse。input表示传递到Web服务的有效负载,

     * output消息表示传递给客户的有效负载。

    *portType:用來定義服務端的SEI

    *operation:用來指定SEI中的處理請求的方法

    *input:指定客戶端應用傳過來的數據,會引用上面的而定義的<message>

    *output:指定服務端返回給客戶端的數據,會引用上面的而定義的<message>

     */

    <wsdl:portType name="HelloServicePortType">

    <wsdl:operation name="sayHello">

      <wsdl:input name="sayHelloRequest" message="tns:sayHelloRequest" />

      <wsdl:output name="sayHelloResponse" message="tns:sayHelloResponse" />

      </wsdl:operation>

      </wsdl:portType>

     

    /**

     * binding 元素描述特定服务接口的协议、数据格式、安全性和其它属性。

     * 针对操作和portType中使用的消息指定实际的协议和数据格式规范。

    *binding:用於定義SEI的實現類

    *type屬性:引用上面的<portType>

    *<soap:operation style="document" /> 綁定的數據是一個document(xml)

    *operation:用來定義實現的方法

    *<soap:operation style="document" /> 傳輸的是document(xml)

    *input:指定客戶端應用傳過來的數據

    *<soap:body use="literal" />:文本數據

    *output:指定服務器端返回客戶端的數據

    *<soap:body use="literal"/>:文本數據

     */

    <wsdl:binding name="HelloServiceHttpBinding" type="tns:HelloServicePortType">

     

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />

    <wsdl:operation name="sayHello">

      <wsdlsoap:operation soapAction="" />

    <wsdl:input name="sayHelloRequest">

      <wsdlsoap:body use="literal" />

      </wsdl:input>

    <wsdl:output name="sayHelloResponse">

      <wsdlsoap:body use="literal" />

      </wsdl:output>

      </wsdl:operation>

     

    </wsdl:binding>

     

     

    /**

     * service元素。服务元素包含一组port元素。端口将端点与来自服务接口定义的binding 元素关联起来。

     * port指定一个绑定的地址,这样定义一个通信的终端。

     *service:一個webservice的容器

     *name:屬性:它用以指定一個服務器端處理請求的入口(就是SEI的實現)

     * binding屬性:引用上面定義的<binding>

     *address:當前webservice的請求地址

     */

    <wsdl:service name="HelloService">

          <wsdl:port name="HelloServiceHttpPort"binding="tns:HelloServiceHttpBinding">

        <soap:address location="http://localhost:8080/xfire/services/HelloService" />

      </wsdl:port>

     </wsdl:service>

     

    </wsdl:definitions>

  • 相关阅读:
    Python导入运行的当前模块报错
    关于相对性的思考
    B+树
    DNS:从零搭建公司内网DNS服务器
    【05】Saltstack:配置详解
    【04】Saltstack:配置管理
    【03】Saltstack:远程执行
    【02】Saltstack:Grains and Pillar
    【01】Saltstack:从零开始 Saltstack
    【08】Kubernets:Service
  • 原文地址:https://www.cnblogs.com/ChrisMurphy/p/5224314.html
Copyright © 2011-2022 走看看