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 ...
随机推荐
- Java示例:如何执行进程并读取输出
下面是一个例子,演示如何执行一个进程(类似于在命令行下键入命令),读取进程执行的输出,并根据进程的返回值判断是否执行成功.一般来说,进程返回 0 表示执行成功,其他值表示失败. import java ...
- Map:目录
ylbtech-Map:目录 1.返回顶部 1.百度地图 http://lbsyun.baidu.com/ 2.高德地图 http://lbs.amap.com/ 3. 2.返回顶部 3. ...
- 与临时对象的斗争(上)ZZ
C++ 是一门以效率见长的语言(虽然近来越来越多的人“不齿”谈及效率,我深以为不然,在某一次的程序编写中不对效率锱铢必较并不意味意味着我们就不应该追求更多的更好的做法).总之吧,相比起其它语言,程序员 ...
- MDD Cup 2017 小记
http://blog.csdn.net/zhangzhengyuan123123/article/details/78971298
- Jacoco统计web接口/功能测试的代码覆盖率【转】
原文:https://www.jianshu.com/p/d2fd02d4164b 一.代码覆盖率 通常我们在做单元测试的时候会接触到代码覆盖率的概念,通过在单元测试的过程中收集代码覆盖率去判断测试用 ...
- manjaro折腾手记
以前装过Arch,有点折腾,写了个hello world就卸载了.没用过AUR,甚至也没去了解. 听说manjaro继承Arch,几乎开箱即用,对硬件支持非常好,源里面的软件更新非常快.但是没有装中文 ...
- LIBTUX_CAT:466: ERROR: tpopen TPERMERR xa_open returned XAER_INVAL
tmboot 启动Tuxedo服务失败,从ULOG日志中看到以下错误: 100534.MATHXH!TMS_ORA10G.22600.4076.0: LIBTUX_CAT:466: ERROR: tp ...
- Mac 解压zip文件错误:无法将"*.zip"解压缩到"" (错误 1-操作不被允许)
错误提示: 无法将"*.zip"解压缩到"" (错误 1-操作不被允许)或者 解压缩失败 英文提示: "Unable to unarchive int ...
- Python之关于量化投资实现代码--根据策略提出的代码--还未完善
# 根据缺口的模式选股买股票 ''' -------------------------------------------- 1.总体回测前要做的事情 initialize(context) 1.1 ...
- Window 包管理工具: chocolatey
传送门 # 官网 https://chocolatey.org/install # 发生错误看看这个https://yevon-cn.github.io/2017/03/12/install-choc ...