Web Service-WSDL详解

WSDL指网络服务描述语言 (Web Services Description Language), 是一种用XML编写的文档, 用于描述Web Service和函数、参数以及返回值等; 文档内规定了服务的位置以及提供的操作、数据类型等;

1.文档内重要节点

  1).portType: 可以理解为模块或者对象, 包含各种可调用的方法(operation)

    portType: 模块或对象名

      operation: 方法名

        documentation: 方法描述

        input: 输入参数 (message=""指调用哪个参数列表)

  2).message: 可以被理解为被portType中函数参数的描述, 也称为消息, 亦可理解为进程中互相传递的信号, 一个信号包括一系列数据, 即一个参数列表;

 1 <message name="getTermRequest">
 2     <part name="term" type="xs:string"/>
 3 </message>
 4 
 5 <message name="getTermResponse">
 6     <part name="value" type="xs:string"/>
 7 </message>
 8 
 9 <portType name="glossaryTerms">
10     <operation name="getTerm">
11         <input message="getTermRequest"/>
12         <output message="getTermResponse"/>
13     </operation>
14 </portType>

    这段代码表示glossaryTerms模块下有个getTerm方法, 其中getTem方法传入一个参数term(xs命名空间定义的string类型; 也可以有多个参数只要加<part name="term1" type="xs:int"/>), 返回一个参数value, 类型为xs命名空间下的string类型;

  3).types: 定义了当前WSDL文档用到的各种数据类型, 用来定义portType模块中各个方法的参数和返回值

  4).binding: 为每个portType定义消息格式和协议细节。

原文地址:https://www.cnblogs.com/JohnABC/p/3392091.html