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 ...
随机推荐
- bootstrap学习总结
bootstrap网站下载: 谷歌浏览器访问:http://github.com/twbs/bootstrap/ 右上角(clone or download) 编译版bootstrap:http ...
- RESTEASY ,从学会使用到了解原理。
转载本文需注明出处:EAII企业架构创新研究院,违者必究.如需加入微信群参与微课堂.架构设计与讨论直播请直接回复公众号:“EAII企业架构创新研究院”.(微信号:eaworld) 1,背景知识; 1. ...
- 360se打开慢,lsass 过高 , cpu温度上升
rd /s /q "%AppData%\Roaming\Microsoft\Protect" rem C:\Users\Administrator\AppData\Roaming\ ...
- [PHP] 多表外连接性能测试及优化
原文:https://blog.csdn.net/tang_huan_11/article/details/41925639 版权声明:本文为博主原创文章,转载请附上博文链接!
- mysql调优最大连接数
一.mysql调优 1.1 报错: Mysql: error 1040: Too many connections 1.2 原因: 1.访问量过高,MySQL服务器抗不住,这个时候就要考虑增加从服务器 ...
- Coursera机器学习+deeplearning.ai+斯坦福CS231n
日志 20170410 Coursera机器学习 2017.11.28 update deeplearning 台大的机器学习课程:台湾大学林轩田和李宏毅机器学习课程 Coursera机器学习 Wee ...
- Python随机字符串验证码
def code_get(self): source = ['] #数字验证码 # source = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','I','J', ...
- js传递数组
注意:数组不能直接作为参数传给后台,需要先用JSON处理成数组字符串,传到后台后再转回数组. var arr_str = JSON.stringify(array)
- [转]恕我直言,在座的各位根本不会写 Java!
导语 自 2013 年毕业后,今年已经是我工作的第 4 个年头了,总在做 Java 相关的工作,终于有时间坐下来,写一篇关于 Java 写法的一篇文章,来探讨一下如果你真的是一个 Java 程序员,那 ...
- FileClassify文件日期分类工具
FileClassify是一款免费的文件按日期分类工具,能够根据文件修改日期,将文件移动或复制到对应的目录中 如果对您有较大的帮助,欢迎捐赠我们,我们对您表示衷心的感谢! 1.输入文件夹和输出文件可以 ...