webservice学习笔记(5)--WSDL文档
来源:互联网 发布:合肥淘宝托管 编辑:程序博客网 时间:2024/05/16 07:27
1.WSDL实例
实例解释
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://ws.day01_ws.atguigu.com/"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http"name="HelloWSImplService" targetNamespace="http://ws.day01_ws.atguigu.com/"><!-- types schema : 定义了一些标签结构 --><wsdl:types><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"xmlns:tns="http://ws.day01_ws.atguigu.com/" elementFormDefault="unqualified"targetNamespace="http://ws.day01_ws.atguigu.com/" version="1.0"><!-- //用于请求<sayHello><arg0>string</arg0></sayHello><q0:sayHello><arg0>BB</arg0> </q0:sayHello>//用于响应<sayHelloResponse><return>string</return></sayHelloResponse><ns2:sayHelloResponse"><return>Hello BB</return> </ns2:sayHelloResponse> --><xs:element name="sayHello" type="tns:sayHello" /><xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /><xs:complexType name="sayHello"><xs:sequence><xs:element minOccurs="0" name="arg0" type="xs:string" /></xs:sequence></xs:complexType><xs:complexType name="sayHelloResponse"><xs:sequence><xs:element minOccurs="0" name="return" type="xs:string" /></xs:sequence></xs:complexType></xs:schema></wsdl:types><!-- message: 用来定义消息的结构 soap消息part : 指定引用types中定义的标签片断 --><wsdl:message name="sayHelloResponse"><wsdl:part element="tns:sayHelloResponse" name="parameters"></wsdl:part></wsdl:message><wsdl:message name="sayHello"><wsdl:part element="tns:sayHello" name="parameters"></wsdl:part></wsdl:message><!-- portType: 用来定义服务器端的SEIoperation : 用来指定SEI中的处理请求的方法input : 指定客户端应用传过来的数据, 会引用上面的定义的<message>output : 指定服务器端返回给客户端的数据, 会引用上面的定义的<message> --><wsdl:portType name="HelloWS"><wsdl:operation name="sayHello"><wsdl:input message="tns:sayHello" name="sayHello"></wsdl:input><wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse"></wsdl:output></wsdl:operation></wsdl:portType><!-- binding : 用于定义SEI的实现类type属性: 引用上面的<portType><soap:binding style="document"> : 绑定的数据是一个document(xml)operation : 用来定义实现的方法<soap:operation style="document" /> 传输的是document(xml)input: 指定客户端应用传过来的数据<soap:body use="literal" /> : 文本数据output : 指定服务器端返回给客户端的数据<soap:body use="literal" /> : 文本数据 --><wsdl:binding name="HelloWSImplServiceSoapBinding" type="tns:HelloWS"><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><!-- service : 一个webservice的容器name属性: 它用一指定客户端容器类port : 用来指定一个服务器端处理请求的入口(就SEI的实现)binding属性: 引用上面定义的<binding>address : 当前webservice的请求地址 --><wsdl:service name="HelloWSImplService"><wsdl:port binding="tns:HelloWSImplServiceSoapBinding" name="HelloWSImplPort"><soap:address location="http://192.168.10.165:8888/day01_ws/hellows" /></wsdl:port></wsdl:service></wsdl:definitions>
2.WSDL文档结构
<definitions>
<types>
<schema>定义约束条件
<element>
</types>
<message>消息(请求消息和响应消息)
<part>
</message>
<portType>
<operation>
<input>
<output>
</portType>
<binding>
<operation>
<input>
<output>
</binding>
<service>
<port>
<address>
</service>
</definitions>
3.消息格式
4元素
WSDL 元素基于XML语法描述了与服务进行交互的基本元素:
(1)Type(消息类型):数据类型定义的容器,它使用某种类型系统(如 XSD)。
(2)Message(消息):通信数据的抽象类型化定义,它由一个或者多个 part组成。用来定义消息的结构
(3)Part:消息参数,用来指定tyes中定义的片段
(4)Operation(操作):对服务所支持的操作进行抽象描述
WSDL定义了四种操作:
1.单向(one-way):端点接受信息;
2.请求-响应(request-response):端点接受消息,然后发送相关消息;
3.要求-响应(solicit-response):端点发送消息,然后接受相关消息;
4.通知(notification[2]):端点发送消息。
(5)Port Type(端口类型):特定端口类型的具体协议和数据格式规范。
(6)Binding:特定端口类型的具体协议和数据格式规范。
(7)Port:定义为绑定和网络地址组合的单个端点。
(8)Service:相关端口的集合,包括其关联的接口、操作、消息等。
5元素之间的关系
- webservice学习笔记(5)--WSDL文档
- WebService学习笔记-WSDL文档分析
- java学习笔记之webservice(二)--WSDL文档及用myeclipse测试webservice
- WebService学习笔记之WSDL
- WebService学习总结(3):如何查看WSDL文档
- webService学习8:wsdl文档解释
- WebService学习总结六 WebService WSDL文档的标签
- (五) WebService-- WSDL 文档详解
- (七) WebService-- 修改WSDL文档
- WebService --WSDL文档解析
- WebService学习笔记(webservice、soap、wsdl、jws详细分析)
- WebService的WSDL文档结构
- webservice的WSDL文档详解
- webService学习1----WSDL
- WebService(4)——WSDL文档解析
- WebService之WSDL文档元素详解 (转)
- Web Service (008---WebService WSDL文档分析)
- WebService之WSDL文档深入分析(三)
- 程序员必看书籍(转发)
- 浅谈安卓gravity和layout_gravity的区别
- 递归那些事
- Android APP用不Crash原理
- 学习Hadoop第八课(利用Java接口来操作Hadoop)
- webservice学习笔记(5)--WSDL文档
- linux开发(一) shell编程要点
- java i+=j 与 i = i+j 区别
- 派生类的说明和构造函数
- Torch7 学习
- 搭建git服务器
- 亿商公益义米公益系统模式开发源码
- ZCMU—1795
- 小厨餐饮加盟有什么优势