WSDL-学习总结
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-学习总结的更多相关文章
- wsdl学习
本文来自 :迹忆 原文地址:http://www.onmpw.com/tm/xwzj/network_47.html 在刚开始学习Webservice的时候,发现里面涉及到的知识点还真不少,每一点单拿 ...
- web services + soap + wsdl 学习
什么是web services? 应用程序组件: 使用开放协议进行通信: 独立(self - contained )并可自我描述: 可通过使用UDDI来发现: 可被其他应用程序使用: XML是Web ...
- Android通过ksoap2这个框架调用webservice大讲堂
昨天有人问我Android怎么连接mysql数据库,和对数据库的操作呀,我想把,给他说说json通信,可是他并不知道怎么弄,哎算了吧,直接叫他用ksoap吧,给他说了大半天,好多零碎的知识,看来还是有 ...
- webService学习之路(三):springMVC集成CXF后调用已知的wsdl接口
webService学习之路一:讲解了通过传统方式怎么发布及调用webservice webService学习之路二:讲解了SpringMVC和CXF的集成及快速发布webservice 本篇文章将讲 ...
- Web Service学习笔记(webservice、soap、wsdl、jws详细分析)
Web Service概述 Web Service的定义 W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API ...
- Web Service学习笔记(webservice、soap、wsdl、jws详细分析) (转)
Web Service概述 Web Service的定义 W3C组织对其的定义如下,它是一个软件系统,为了支持跨网络的机器间相互操作交互而设计.Web Service服务通常被定义为一组模块化的API ...
- webservice学习01:wsdl文档结构
webservice学习01:wsdl文档结构 wsdl文档结构 WSDL文档示例 <wsdl:definitions xmlns:xsd="http://www.w3.org/200 ...
- CXF学习(3) wsdl文件
<!--一次webservice调用,其实并不是方法调用,而是发送SOAP消息 ,即xml片段--> <!--以上一篇中的wsdl文档为例,这里我将注释写到文档中 --> &l ...
- Web Service学习之五:WSDL详解
WSDL是Web Service定义文档,不同平台 不同语言实现Web Service遵循的共同协议 ,在解析XML时按照各自语言的特点解析成相应的具体类.方法.参数和数据类型. WSDL是一个XML ...
- php学习之道:WSDL具体解释(三)
通过声明方式定义绑定(binding)属性 假设你在服务中採用SOAP binding.你能够使用JAX-WS来指定一定数量的属性binding. 这些属性指定相应你在WSDL中指定的属性.某些设置. ...
随机推荐
- python_day2学习笔记
基本数据类型 1.数字 int(整型) 在32位机器上,整数的位数为32位,取值范围为-2**31-2**31-1,即-2147483648-2147483647 在64位系统上,整数的位数为64位, ...
- Xshell 找到上次执行的命令
ctrl + p 返回上一次输入命令字符 ctrl + r 输入单词搜索历史命令
- json转换工具——fastjson的使用
1.maven依赖<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson< ...
- golang实现mysql数据库备份
背景 navicat是mysql可视化工具中最棒的,但是,在处理视图的导入导出方面,它是按照视图名称的字母顺序来处理的,若视图存在依赖,在导入过程中就会报错.前面已经用python写了一个,但在使用过 ...
- HDMI 电视 点对点 桌面超出屏幕
一直在用电视作显示器,但是没有注意点对点到问题,只是感觉字体发虚.直到今天装win10,桌面会超出屏幕,使用intel控制面板调整分辨率后正常,但是注销或重启会再次回复.百度无果,自己摸索,不仅解决了 ...
- nginx安装及配置文件详解
一)nginx安装及模块讲解 1.1.nginx安装步骤 mkdir /soft wget http://nginx.org/download/nginx-1.12.0.tar.gz tar zxf ...
- 解决CDH的web界面使用nginx代理一些静态文件无法加载
vim /opt/cm-/share/cmf/webapp/WEB-INF/spring/mvc-config.xml .... 注释此行 <bean class="com.cloud ...
- 【图论】The Bottom of a Graph
[POJ2553]The Bottom of a Graph Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 11182 ...
- HDU 6057 Kanade's convolution(FWT)
[题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6057 [题目大意] 有 C[k]=∑_(i&j=k)A[i^j]*B[i|j] 求 Ans ...
- [xsy2282]cake
题意:一个$n\times n$的有标号点阵,现在用一条直线把它们分成两部分,问有多少种不同的分法 结论:方案数就是以点阵上的点为端点且不经过第三个点的线段数 对一个满足要求的线段,将其绕中点顺时针转 ...