WSDL是web service标准当中描述语言,服务器端通过wsdl可以描述发布的服务,客户端通过获取服务端提供的wsdl了解服务器端,以便调用服务器端提供的服务。
元素
|
定义
|
<portType>
|
web service 执行的操作
|
<message>
|
web service 使用的消息
|
<types>
|
web service 使用的数据类型
|
<binding>
|
web service 使用的通信协议
|
<service>
|
web service 使用的服务名称和地址
|
下面分段了解一下wsdl的详细描述吧。我们通过一个搜索方法来描述,该方法提供输入搜索字段和搜索关键字,分别是String类型的。返回结果是一个结果集,用List类型保存。我们按照上面的表格来一个个的分析下WSDL的构成。
<service>元素描述
<wsdl:service name="SimpleSearch_Server">
<wsdl:port name="SimpleSearch_ServerHttpPort" binding="tns:SimpleSearch_ServerHttpBinding">
<wsdlsoap:address location="http://localhost:8080/Patent_Demo/services/SimpleSearch_Server" />
</wsdl:port>
</wsdl:service>
1. 申明该服务的名称是SimpleSearch_Server
2. Binding表示需要绑定的通信协议是什么,绑定到wsdl当中的binding元素,这里指定到SimpleSearch_ServerHttpBinding当中。
3. 申明提供的服务地址是:
http://localhost:8080/Patent_Demo/services/SimpleSearch_Server通过访问
http://localhost:8080/Patent_Demo/services/SimpleSearch_Server?wsdl可以查看wsdl信息
<binding>元素描述
<wsdl:binding name="SimpleSearch_ServerHttpBinding" type="tns:SimpleSearch_ServerPortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="search">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="searchRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
<wsdl:output name="searchResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
1. 申明该binding名称是SimpleSearch_ServerHttpBinding
2.
指定该binding指定的操作元素为tns:SimpleSearch_ServerPortType
3.
该服务提供search方法,并具有request-response模式。消息传递类型为literal
<Port-type>元素描述
<wsdl:portType name="SimpleSearch_ServerPortType">
<wsdl:operation name="search">
<wsdl:input name="searchRequest" message="tns:searchRequest" />
<wsdl:output name="searchResponse" message="tns:searchResponse" />
</wsdl:operation>
</wsdl:portType>
1.
定义提供search方法
2.
定义request-response模式,并制定消息类型为searchRequest和searchResponse
<message>元素描述
<wsdl:message name="searchResponse">
<wsdl:part name="parameters" element="tns:searchResponse" />
</wsdl:message>
<wsdl:message name="searchRequest">
<wsdl:part name="parameters" element="tns:search" />
</wsdl:message>
1.
对应port-type当中的消息类型,以searchResponse为例,当用户发送请求的时候,定义请求参数类型为search
2.
searchResponse当中定义了当请求处理完毕向用户返回参数的类型为searchResponse。两者都对应到<type>元素当中
<type>元素描述
<wsdl:types>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://service.ws.patent.com">
<xsd:element name="search">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ArrayOfString">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="string" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="searchResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="tns:ArrayOfString" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
1.
search类型对应message消息当中请求消息类型,searchResponse同样如此。
2.
search当中定义请求的第0,1个参数分别用String类型表示
3.
searchResponse中定义返回以几何形式(ArrayofString)类型。ArrayofString在type元素当中也有定义,表示由String组成的类型组成
回去吃饭洛
分享到:
相关推荐
自动生成WSDL服务端描述文件时,泛型集合无法自动映射的解决方法
XML Web Service描述语言WSDL详解 利用WSDL语言描述网络服务
电信sms的WSDL描述文件,官方的wsdl文件
Web服务描述语言WSDL wsdl
WSDL(Web服务描述语言)详细解析
web service描述语言,讲解详细,适用于初学者,理论加实践。
onvif 最新wsdl描述文件,2.4版本,需要的拿去看看吧
详细描述了wsdl文件的一些属性及其意义
Web Service描述语言 WSDL 详解
wsdl的描述
Web Service描述语言 WSDL 详解.pdf
WSDL资料的描述资料,对WSDL有一个较清晰地分析!
wsdl 详细介绍 WSDL (Web Services Description Language,Web服务描述语言)是一种XML Application,他将Web服务描述定义为一组服务访问点,客户端可以通过这些服务访问点对包含面向文档信息或面向过程调用的服务进行...
现有的Web服务描述文档(如W3C的WSDL标准)缺乏对服务行为的有效描述,使得这些自动化服务组合方法在实际中不可行。针对该问题,提出一种在WSDL中扩展服务行为描述的服务接口方案,基于GMF实现服务行为编辑器,帮助...
WSDL Web服务描述语言
WSDL (Web Services Description Language,Web服务描述语言)是一种XML Application,他将Web服务描述定义为一组服务访问点,客户端可以通过这些服务访问点对... 本文将详细讲解WSDL文档的结构,并分析每个元素的作用
之前有人写过,但是有点错误,并且描述不是很清晰。这是我的完整解析wsdl的方法 wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl wsdl
Web Service描述语言 WSDL 详解.doc
Web Service描述语言 WSDL 详解 博文链接:https://whistler.iteye.com/blog/89201