Webservice学习之WSDL详解
1. <definitions/>
这部分在基础篇里已经介绍,主要说明引用了哪些schema以及schema的位置等,可以看下基础篇的介绍,SayHello的Demo这部分内容如下:
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://impl.service.server.ws.devins.com/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns2="http://schemas.xmlsoap.org/soap/http"
xmlns:ns1="http://service.server.ws.devins.com/" name="SayHelloImplService"
targetNamespace="http://impl.service.server.ws.devins.com/">
2. <types/>
<types> 元素定义 web service 使用的数据类型,为了最大程度的平台中立性,WSDL 使用 XML Schema 语法来定义数据类型
<!--
types
schema:约束xml格式
element:用来指定xml中的标签
<sayHello></sayhello>
<sayHelloResponse></sayHelloResponse>
complexType:说明是一个复合类型
请求
<sayHello>
<arg0>string</arg0>
</sayhello>
响应
<sayHelloResponse>
<return>string</return>
</sayHelloResponse> 回看下demo的请求与响应的核心内容
<q0:sayHello>
<arg0>devins</arg0>
</q0:sayHello> <ns2:sayHelloResponse">
<return>Hello: devins</return>
</ns2:sayHelloResponse> -->
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://service.server.ws.devins.com/" elementFormDefault="unqualified"
targetNamespace="http://service.server.ws.devins.com/" version="1.0">
<xs:element name="sayHello" type="tns:sayHello" />
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
<xs:complexType name="sayHello">
<xs:sequence>
<xs:element minOccurs="" name="arg0" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element minOccurs="" name="return" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
3. <message/>
<message> 元素定义一个操作的数据元素,每个消息均由一个或多个部件组成。可以把这些部件比作传统编程语言中一个函数调用的参数。
<!--
message:用来定义soap消息结构
part:部分/组成的意思
实际上引用的就是上面schema中的约束格式
-->
<wsdl:message name="sayHelloResponse">
<wsdl:part element="ns1:sayHelloResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="sayHello">
<wsdl:part element="ns1:sayHello" name="parameters" />
</wsdl:message>
4. <portType/>
<portType> 元素是最重要的 WSDL 元素,它可描述一个 web service、可被执行的操作,以及相关的消息,可以把 <portType> 元素比作传统编程语言中的一个函数库(或一个模块、或一个类)。
<!--
portType:用来指定服务器端的SEI(接口)
operation:表示操作/行为,即SEI中定义的方法
input:方法sayHello的输入
output:方法sayHello的输出
输入输出引用的是上面message的定义
-->
<wsdl:portType name="ISayHello">
<wsdl:operation name="sayHello">
<wsdl:input message="ns1:sayHello" name="sayHello" />
<wsdl:output message="ns1:sayHelloResponse" name="sayHelloResponse" />
</wsdl:operation>
</wsdl:portType>
5. <binding/>
<binding> 元素为每个端口定义消息格式和协议细节。
<!--
binding:用来指定SEI的实现类
type属性:引用<portType>定义
<soap:binding style="document">:表示传输的一个document (xml)
<input><output>与上节说的相同
<soap:body use="literal" />:表示body传输采用文本即xml格式的文本
-->
<wsdl:binding name="SayHelloImplServiceSoapBinding" type="ns1:ISayHello">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="sayHello">
<soap:operation soapAction="" style="document" />
<wsdl:input name="sayHello">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
6. <service>
<!--
service:相同于webservice容器,也可理解为一个工厂
name:用于指定客户端的容器类/工厂类,客户端代码从此类开始
port:用来指定服务器端的一个入口(对应SEI的实现类)
port binding:引用上面定义的
port name:容器通过这个方法获得实现类
address:客户端真正用于请求的地址 回想我们的demo:
SayHelloImplService factory = new SayHelloImplService();
SayHelloImpl sayHelloImpl = factory.getSayHelloImplPort();
-->
<wsdl:service name="SayHelloImplService">
<wsdl:port binding="tns:SayHelloImplServiceSoapBinding"
name="SayHelloImplPort">
<soap:address location="http://132.122.239.74:8089/ws/sayhello" />
</wsdl:port>
</wsdl:service>
7. 总结

转自:https://blog.csdn.net/posonrick/article/details/45580355?utm_source=blogxgwz1
Webservice学习之WSDL详解的更多相关文章
- WebService中的WSDL详解 及jmeter测试
首先简单讲解一下什么是wsdl. 一个WSDL文档通常包含8个重要的元素,即definitions.types.import.message.portType.operation.bin ...
- iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem
http://blog.csdn.net/totogo2010/article/details/7681879 1.UINavigationController导航控制器如何使用 UINavigati ...
- [转]iOS学习之UINavigationController详解与使用(三)ToolBar
转载地址:http://blog.csdn.net/totogo2010/article/details/7682641 iOS学习之UINavigationController详解与使用(二)页面切 ...
- [转]iOS学习之UINavigationController详解与使用(二)页面切换和segmentedController
转载地址:http://blog.csdn.net/totogo2010/article/details/7682433 iOS学习之UINavigationController详解与使用(一)添加U ...
- 各大公司广泛使用的在线学习算法FTRL详解
各大公司广泛使用的在线学习算法FTRL详解 现在做在线学习和CTR常常会用到逻辑回归( Logistic Regression),而传统的批量(batch)算法无法有效地处理超大规模的数据集和在线数据 ...
- 跟我学机器视觉-HALCON学习例程中文详解-FUZZY检测用于开关引脚测量
跟我学机器视觉-HALCON学习例程中文详解-FUZZY检测用于开关引脚测量 * This example program demonstrates the basic usage of a fuzz ...
- 跟我学机器视觉-HALCON学习例程中文详解-测量圆环脚宽间距
跟我学机器视觉-HALCON学习例程中文详解-测量圆环脚宽间距 This example program demonstrates the basic usage of a circular meas ...
- 跟我学机器视觉-HALCON学习例程中文详解-开关引脚测量
跟我学机器视觉-HALCON学习例程中文详解-开关引脚测量 This example program demonstrates the basic usage of a measure object. ...
- 跟我学机器视觉-HALCON学习例程中文详解-QQ摄像头读取条码
跟我学机器视觉-HALCON学习例程中文详解-QQ摄像头读取条码 第一步:插入QQ摄像头,安装好驱动(有的可能免驱动) 第二步:打开HDevelop,点击助手-打开新的Image Acquisitio ...
随机推荐
- sort函数比较cmp写法
hihocoder1566http://hihocoder.com/problemset/problem/1566 一直WA因为cmp的写法写错了,未能正确实现排序功能. #include<io ...
- spring跨域问题
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Co ...
- 用SublimeText当Unity Shader的编辑器
用Visual Studio写shader实在蛋疼,那可能就会有人要问了,为啥不用插件可视化制作shader呢?因为我是新手,新手还是老老实实敲代码,慢慢来- 所以试着在网上找找,有没有类似的插件或者 ...
- windows环境下面批量修改文件夹名称
ren 1 A ren 2 B ren 3 C ren 4 D 电脑桌面新建文档 ---> 批量修改文件夹名称.txt 修改文件名称为:--->批量修改文件夹名称.bat 内容如上: 双击 ...
- SOFABolt 源码分析
SOFABolt 是一个轻量级.高性能.易用的远程通信框架,基于netty4.1,由蚂蚁金服开源. 本系列博客会分析 SOFABolt 的使用姿势,设计方案及详细的源码解析.后续还会分析 SOFABo ...
- C# CountdownEvent实现
关于CountdownEvent网上的介绍比较少,因为它是实现和使用都很简单,先看看网上的一些评论吧: CountDownEvent调用成员函数Wait()将阻塞,直至成员函数Signal() 被调用 ...
- c# System.Threading.Thread
using System; using System.Threading; // Simple threading scenario: Start a static method running // ...
- Xtrabackup简介
Xtrabackup是由 Percona 开发的一个开源软件,可实现对 InnoDB 的数据备份,支持在线热备份(备份时不影响数据读写),特点如下: 备份过程快速.可靠: 备份过程不会打断正在执行的事 ...
- MATLAB 程序计算结果出现 复数(a+bi)问题
存在对负数开根号的情况了: >> (0.777)^0.1 ans = 0.9751 >> ( ans = 0.6037 >> (0.777)^2.1 ans = 0 ...
- 使用xshell+xmanager+pycharm搭建pytorch远程调试开发环境
1. 相关软件版本 xshell: xmanager: pycharm: pycharm破解服务器:https://jetlicense.nss.im/ 2. 将相应的软件安装(pojie好) a&g ...