1.什么是WSDL

  是一种使用 XML 编写的文档。这种文档可描述某个 Web service。它可规定服务的位置,以及此服务提供的操作(或方法)。

2.WSDL文档结构:

<binding> web service 使用的通信协议;为每一个<protTypes>定义消息格式和通信协议;有services引用;
<portType> web service 可以执行的操作(operation)相当于一个函数库,其中定义的每一个操作可以被看做是一个函数;被binding调用;
<message> web service 使用的消息;被operation调用,相当于函数的参数,有入参(input)和出参(output);message中的part,指定函数中的参数名和参数类型;
<types> web service 使用的数据类型;被<message>调用;在<types>中定义了元素以及元素的类型;

以GetServices为例

////////////////////////////////<types>
<wsdl:types>
<xs:schema targetNamespace="http://www.onvif.org/ver10/device/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" elementFormDefault="qualified" version="18.12">
<xs:import namespace="http://www.onvif.org/ver10/schema" schemaLocation="../../../ver10/schema/onvif.xsd"/>
<!--===============================-->
<xs:element name="GetServices">
<xs:complexType>
<xs:sequence>
<xs:element name="IncludeCapability" type="xs:boolean">
<xs:annotation>
<xs:documentation>Indicates if the service capabilities (untyped) should be included in the response.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetServicesResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Service" type="tds:Service" maxOccurs="unbounded">    //这里需要注意的是,"type= "tds:Service""指定的类型是下面的complexTpye name = "Service"
<xs:annotation>
<xs:documentation>Each Service element contains information about one service.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!--===============================-->
<xs:complexType name="Service">  //自定义一种复杂的数据类型 “Service”,请求消息或者响应消息时需要严格按照数据类型格式;
<xs:sequence>
<xs:element name="Namespace" type="xs:anyURI">      //这里的“anyURL”是xml schmea中的杂项数据类型,表示Namespace元素值可以是任意类型的URI;
<xs:annotation>
<xs:documentation>Namespace of the service being described.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="XAddr" type="xs:anyURI">
<xs:annotation>
<xs:documentation>The transport addresses where the service can be reached.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="Capabilities" minOccurs="0">  //表示<Capabilities>元素最少可以出现0次;如果不明确声明出现的次数,则元素最少出现一次,最多出现一次
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="lax">
<xs:annotation>
<xs:documentation>The placeholder for the service capabilities.</xs:documentation>
</xs:annotation>
</xs:any>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Version" type="tt:OnvifVersion">
<xs:annotation>
<xs:documentation>The version of the service (not the ONVIF core spec version).</xs:documentation>
</xs:annotation>
</xs:element>
<xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> //<any> 元素使我们有能力可以使用未被 schema 规定的元素来拓展 XML 文档!
</xs:sequence>
<xs:anyAttribute processContents="lax"/> //<anyAttribute> 元素使我们有能力使用未被 schema 规定的属性来扩展 XML 文档!
</xs:complexType>
</wsdl:types>
///////////////////////////////<message>
<wsdl:message name="GetServicesRequest">
<wsdl:part name="parameters" element="tds:GetServices"/> //把massage定义了操作的参数:part则是定义的参数;
</wsdl:message>
<wsdl:message name="GetServicesResponse">
<wsdl:part name="parameters" element="tds:GetServicesResponse"/>
</wsdl:message>
///////////////////////////////<portType>
<wsdl:portType name="Device">
<wsdl:operation name="GetServices">
<wsdl:documentation>Returns information about services on the device.</wsdl:documentation>
<wsdl:input message="tds:GetServicesRequest"/>
<wsdl:output message="tds:GetServicesResponse"/>
</wsdl:operation>
</wsdl:portType>
////////////////////////////////<binding>
<wsdl:binding name="DeviceBinding" type="tds:Device"> //指向binding的端口,此处指向“Device”;
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> //style取值只能为“rpc”或者“document”;transport定义了要使用的SOAP协议,这里使用http;
<wsdl:operation name="GetServices">
<soap:operation soapAction="http://www.onvif.org/ver10/device/wsdl/GetServices"/> //定义了每个端口提供的操作符;
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

下图概要描述了<binding>,<message>,<types>,<portTypes>之间的关系

  1.箭头连接符代表文档不同栏之间的关系。

  2.点和箭头代表了引用或使用关系。

  3.双箭头代表"修改"关系。

  4.3-D的箭头代表了包含关系。

这样,

  各Messages栏使用Types栏的定义;

    PortTypes栏使用Messages栏的定义;

  Bindings栏引用了PortTypes栏;

  Services栏引用Bindings栏;

  PortTypes和Bindings栏包含了operation元素,而Services栏包含了port元素。

  PortTypes栏里的operation元素由Bindings栏里的operation元素进一步修改或描述。

WSDL-学习总结的更多相关文章

  1. wsdl学习

    本文来自 :迹忆 原文地址:http://www.onmpw.com/tm/xwzj/network_47.html 在刚开始学习Webservice的时候,发现里面涉及到的知识点还真不少,每一点单拿 ...

  2. web services + soap + wsdl 学习

    什么是web services? 应用程序组件: 使用开放协议进行通信: 独立(self - contained )并可自我描述: 可通过使用UDDI来发现: 可被其他应用程序使用: XML是Web ...

  3. Android通过ksoap2这个框架调用webservice大讲堂

    昨天有人问我Android怎么连接mysql数据库,和对数据库的操作呀,我想把,给他说说json通信,可是他并不知道怎么弄,哎算了吧,直接叫他用ksoap吧,给他说了大半天,好多零碎的知识,看来还是有 ...

  4. webService学习之路(三):springMVC集成CXF后调用已知的wsdl接口

    webService学习之路一:讲解了通过传统方式怎么发布及调用webservice webService学习之路二:讲解了SpringMVC和CXF的集成及快速发布webservice 本篇文章将讲 ...

  5. Web Service学习笔记(webservice、soap、wsdl、jws详细分析)

    Web Service概述 Web Service的定义 W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API ...

  6. Web Service学习笔记(webservice、soap、wsdl、jws详细分析) (转)

    Web Service概述 Web Service的定义 W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API ...

  7. webservice学习01:wsdl文档结构

    webservice学习01:wsdl文档结构 wsdl文档结构 WSDL文档示例 <wsdl:definitions xmlns:xsd="http://www.w3.org/200 ...

  8. CXF学习(3) wsdl文件

    <!--一次webservice调用,其实并不是方法调用,而是发送SOAP消息 ,即xml片段--> <!--以上一篇中的wsdl文档为例,这里我将注释写到文档中 --> &l ...

  9. Web Service学习之五:WSDL详解

    WSDL是Web Service定义文档,不同平台 不同语言实现Web Service遵循的共同协议 ,在解析XML时按照各自语言的特点解析成相应的具体类.方法.参数和数据类型. WSDL是一个XML ...

  10. php学习之道:WSDL具体解释(三)

    通过声明方式定义绑定(binding)属性 假设你在服务中採用SOAP binding.你能够使用JAX-WS来指定一定数量的属性binding. 这些属性指定相应你在WSDL中指定的属性.某些设置. ...

随机推荐

  1. gridcontrol的列头右键菜单问题

    Dev控件GridControl设置了一个右键菜单 this.gridControl1.ContextMenu = contextMenu2; 而GridControl在运行排序的时候,即 gridv ...

  2. hdu 1853(拆点判环+费用流)

    Cyclic Tour Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/65535 K (Java/Others)Total ...

  3. Python3判断自身脚本是不是在运行

    采用Socket方式,启动时占用一个端口,转化问题为判断端口是不是存在? import sys import locale import http.server import socketserver ...

  4. AC日记——明明的烦恼 bzoj 1005

    1005 思路: prufer编码+组合数: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 1005 #de ...

  5. BC-NFS部署报错节点间磁盘wwid冲突

    1.在部署公司的BC-NFS产品时,填好IP选好磁盘后,点击“创建”,就抛出如下提示: 2.关闭虚机,再打开虚机的控制台,点击磁盘,自定义serial number 3.启动虚机,再次登陆,查看磁盘w ...

  6. LoadRunner Agent Runtime Settings Configuration启动报错

    解决方法: 关闭负载机器上的防火墙功能即可解决

  7. 谈谈对final的理解

    1.final修饰类 类不能被继承,类中的所有方法都是final的 2.final修饰方法 方法不能被覆盖,private修饰的方法隐性的添加了final 3.final修饰方法内参数 方法内的参数不 ...

  8. AngularJS自定义指令及指令配置项

    两种写法 //第一种 angular.module('MyApp',[]) .directive('zl1',zl1) .controller('con1',['$scope',func1]); fu ...

  9. webpack配置点记录

    jsx语法需要用到babel-preset-react: 通用babel-loader相关如下: 以上配置还只能针对ES6情况,static defaultProps是ES7的特性,需要引入新的配置:

  10. 深度学习应用系列(一)| 在Ubuntu 18.04安装tensorflow 1.10 GPU版本

    tensorflow目前已经升级至r1.10版本.在之前的深度学习中,我是在MAC的虚拟机上跑CPU版本的tensorflow程序,当数据量变大后,tensorflow跑的非常慢,在内存不足情况下,又 ...