转 wsdl
来源:互联网 发布:医疗优化站不收录 编辑:程序博客网 时间:2024/04/29 05:19
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>
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>
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>
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>
2. search当中定义请求的第0,1个参数分别用String类型表示
3. searchResponse中定义返回以几何形式(ArrayofString)类型。ArrayofString在type元素当中也有定义,表示由String组成的类型组成
- 转 wsdl
- 什么是WSDL?(转)
- 【转】wsdl完全解析
- WSDL详解(转)
- onvif wsdl转java
- axis1 wsdl转java
- WSDL
- wsdl
- wsdl
- WSDL
- WSDL
- wsdl
- WSDL
- WSDL
- WSDL
- WSDL
- WSDL
- wsdl
- 理解Linux的硬连接与软连接
- 如何生成vfh特征值pcd文件
- linux中安装软件
- 南邮 OJ 2098 3_A+B(III)
- bzoj3343: 教主的魔法
- 转 wsdl
- UIWebView网页视图—IOS开发
- 运放
- C#-WinForm设置托盘程序
- Nim or not Nim?(hdu3032+SG函数)取走-分割游戏,经典
- Java中的软引用,强引用与弱引用
- java注解学习笔记
- hdu5358
- uva 1345 Jamie's Contact Groups (最大流+二分)