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. Leetcode 之Anagrams(35)

    回文构词法,将字母顺序打乱.可将字母重新排序,若它们相等,则属于同一组anagrams. 可通过hashmap来做,将排序后的字母作为key.注意后面取hashmap值时的做法. vector< ...

  2. Django web框架之模板

    1 模板: 什么是模板? html+模板语法 模版包括在使用时会被值替换掉的 变量,和控制模版逻辑的 标签. 2 模板语法: 1 变量:{{}} 深度查询: 通过句点符号 . 过滤器 filter { ...

  3. GT-----如何做Android应用流量测试?

    1.如何判断一个应用的流量偏高? 如果看流量的绝对值看不出高低,那就找几个同类型的产品对比一下,如果完成同样的事物,被测应用比同类产品高很多,那就偏高了,可能有优化的空间. 2.如何找到有效的优化点? ...

  4. ARK登录信息

    101,389B,382:仙境353:中心岛380:畸变404:孤岛371:焦土487:灭绝 eaglexmw:389b[65493013] : 初级畸变,高级飞升,TEK全解(有380权限),黑鬼, ...

  5. Shiro源码分析之Subject和SecurityManager

    Subject 毫无疑问,Subject是Shiro最重要的一个概念. “Subject”只是一个安全术语,意味着应用程序用户的特定于安全性的“视图”.Shiro Subject实例代表单个应用程序用 ...

  6. 洛谷——P1068 分数线划定

    P1068 分数线划定 题目描述 世博会志愿者的选拔工作正在 A 市如火如荼的进行.为了选拔最合适的人才,A 市对 所有报名的选手进行了笔试,笔试分数达到面试分数线的选手方可进入面试.面试分数线根 据 ...

  7. Spring的消息 Java Message Service (JMS)

     Spring有两种方法提供对EJB的支持: Spring能让你在Spring的配置文件里,把EJB作为Bean来声明.这样,把EJB引用置入到其他Bean的属性里就成为可能了,好像EJB就是另一个P ...

  8. 离线情报分析工具CaseFile

    离线情报分析工具CaseFile   CaseFile是Maltego的姊妹工具,功能非常类似于Maltego.CaseFile主要针对数据进行离线分析,缺少Maltego的数据采集功能.它可以导入各 ...

  9. CodeForces 380C Sereja and Brackets(扫描线+树状数组)

    [题目链接] http://codeforces.com/problemset/problem/380/C [题目大意] 给出一个括号序列,求区间内左右括号匹配的个数. [题解] 我们发现对于每个右括 ...

  10. 【计算几何】【预处理】【枚举】Urozero Autumn Training Camp 2016 Day 5: NWERC-2016 Problem K. Kiwi Trees

    发现由于角的度数和边的长度有限制,那俩圆如果放得下的话,必然是塞在两个角里. 于是预处理n个圆心的位置(注意要判断那个圆会不会和其他的边界相交),然后n^2枚举俩角即可. #include<cs ...