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 ...
随机推荐
- django中数据库操作有关部分
# >>>>>>>>>>>>>>>>>>>>>>>>&g ...
- 11 week blog
Obtaining the JSON: 1.首先,我们将把要检索的JSON的URL存储在变量中. 2.要创建请求,我们需要使用new关键字从XMLHttpRequest构造函数创建一个新的请求对象实例 ...
- 利用Vmware 创建Linux虚拟机的方法
https://blog.csdn.net/qq_34929457/article/details/52663265 使用VMware新建一个Linux系统虚拟机 原创 2016年09月25日 17: ...
- jQuery Distpicker插件 省市区三级联动 动态赋值修改地址
在获取创建页面数据后需要在编辑页面调取之前提交的数据,在使用这个插件后发现无法动态赋值,查找资料后发现需要先销毁实例,$(’#target’).distpicker(‘destroy’); 第一步 引 ...
- 在python里调用java的py4j的使用方法
py4j可以使python和java互调 py4j并不会开启jvm,需要先启动jvm server,然后再使用python的client去连接jvm GatewayServer实例:允许python程 ...
- UART简介及与COM口的区别
原帖地址:https://blog.csdn.net/jirryzhang/article/details/70084743 https://www.cnblogs.com/smartjourneys ...
- Android、iOS、和Web如何做灰度发布?
主要参考了: https://www.zhihu.com/question/21714205 https://www.zhihu.com/question/28296375 一.概述 ...
- JSONArray数据转换成java List
1.后台接收json数组转成封装实体类的List: package no.integrasco.ingentia.news.qaedition; public class Person { priva ...
- srs2.0安装问题
原文: https://blog.csdn.net/ddr77/article/details/52511340 编译配置如下 ./configure --disable-all --with-ssl ...
- [Functional Programming] Functional JS - Pointfree Logic Functions
Learning notes. Video. Less than: If you use 'ramda', you maybe know 'lt, gt'.. R.lt(2, 1); //=> ...