WEB服务描述语言_第1页
WEB服务描述语言_第2页
WEB服务描述语言_第3页
WEB服务描述语言_第4页
WEB服务描述语言_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第5章 WEB服务描述语言内容摘要: WSDL是一个基于XML的语言,用来描述WEB服务接口方法、调用方法所使用的协议,方法的参数以及参数的数据类型等内容。总之,WSDL中包含了访问WEB服务需要的所有数据。了解WSDL可以加深对WEB服务的理解,并可以对自动生成的WSDL文档进行调整,以及解决一些与WSDL相关的问题。学习目标:了解WSDL的概念掌握WSDL的文档结构掌握WSDL文档元素的作用WSDL概念:WEB服务的描述语言,相当于WEB服务使用说明书。WSDL文档结构具体这5个元素的功能和作用:types:定义了WEB服务使用的所有数据类型集合,可被各消息组件所引用。通常使用XML Sc

2、hema作为类型系统来描述。messages:定义了消息和消息传输的抽象类型化定义。porttype:是一个抽象操作的列表,定义了所有操作和返回的逻辑消息。bingding:为每个具体的端口类型定义消息格式和协议。services:定义了WEB服务的URL地址信息。WSDL 接口定义前三个元素是抽象定义,后两个元素是具体实现。实例:<?xml version="1.0" encoding="utf-8" ?> - <wsdl:definitions xmlns:soap="/w

3、sdl/soap/" xmlns:tm=" xmlns:soapenc="/soap/encoding/" xmlns:mime="/wsdl/mime/" xmlns:tns="/" xmlns:s="/2001/XMLSchema" xmlns:soap12="/wsd

4、l/soap12/" xmlns:http="/wsdl/http/" targetNamespace="/" xmlns:wsdl="/wsdl/"> - <wsdl:types> - <s:schema elementFormDefault="qualified" targetNamespace="/&

5、quot;> - <s:element name="HelloWorld">  <s:complexType />   </s:element> - <s:element name="HelloWorldResponse"> - <s:complexType> - <s:sequence>  <s:element minOccurs="0" maxOccurs="1" name="HelloW

6、orldResult" type="s:string" />   </s:sequence>  </s:complexType>  </s:element> - <s:element name="GetDataSet"> <!- WEBBANK 服务端第一个函数对应的XML元素-> + <s:complexType>+ <s:sequence>  <s:element minOccurs="0&quo

7、t; maxOccurs="1" name="safeSql" type="s:string" />   </s:sequence>  </s:complexType>  </s:element> - <s:element name="GetDataSetResponse"> <!- WEBBANK 服务端第一个函数对应的XML元素的响应元素-> - <s:complexType> - <s:seque

8、nce> - <s:element minOccurs="0" maxOccurs="1" name="GetDataSetResult"><!- WEBBANK 服务端第一个函数对应的形参>- <s:complexType>- <s:sequence>  <s:element ref="s:schema" />   <s:any />   </s:sequence>  </s:c

9、omplexType>  </s:element>  </s:sequence>  </s:complexType>  </s:element>- <s:element name="executeSQL"><!- WEBBANK 服务端第三个函数对应的XML元素->- <s:complexType>- <s:sequence>  <s:element minOccurs="0" maxOccurs=

10、"1" name="sql" type="s:string" /> <!- WEBBANK 服务端第三个函数对应的形参“sql”的XML元素->  </s:sequence>  </s:complexType>  </s:element>- <s:element name="executeSQLResponse"><!- WEBBANK 服务端第三个函数对应的XML元素的响应元素->- <s:compl

11、exType>- <s:sequence>  <s:element minOccurs="1" maxOccurs="1" name="executeSQLResult" <!- WEBBANK 服务端第三个函数对应的形参>type="s:int" />   </s:sequence>  </s:complexType>  </s:element>  </s:schema>&#

12、160; </wsdl:types><!- message部分->- <wsdl:message name="HelloWorldSoapIn">  <wsdl:part name="parameters" element="tns:HelloWorld" />   </wsdl:message>- <wsdl:message name="HelloWorldSoapOut">  <wsdl:part nam

13、e="parameters" element="tns:HelloWorldResponse" />   </wsdl:message>- <wsdl:message name="GetDataSetSoapIn"><!- WEBBANK 服务端第一个函数MESSAGE 元素中的输入方法GetDataSetSoapIn ->  <wsdl:part name="parameters" element="tns:GetDataSet&quo

14、t; /> <!- 输入方法GetDataSetSoapIn 中大part元素parameters 类型由GetDataSet决定->  </wsdl:message>- <wsdl:message name="GetDataSetSoapOut"><!- WEBBANK 服务端第一个函数MESSAGE 元素中的输出方法GetDataSetSoapOut->  <wsdl:part name="parameters" element="tns:GetDataSetR

15、esponse" /><!- 输入方法GetDataSetSoapOut 中的part元素parameters 类型由GetDataSeResponset决定->   </wsdl:message>- <wsdl:message name="executeSQLSoapIn"><!- WEBBANK 服务端第三个函数MESSAGE 元素中的输入方法executeSqLSoapIn ->  <wsdl:part name="parameters" element=&q

16、uot;tns:executeSQL" /> <!- 输入方法executeSqLSoapIn 中的part元素parameters 类型由executeSqL决定-></wsdl:message>- <wsdl:message name="executeSQLSoapOut"><!- WEBBANK 服务端第三个函数MESSAGE 元素中的输出方法executeSqLSoapOut -> <wsdl:part name="parameters" element="tns:e

17、xecuteSQLResponse" /> <!- 输出方法executeSqLSoapOut 中的part元素parameters 类型由executeSqLResponse决定-></wsdl:message>- <wsdl:portType name="ServiceSoap"><!-portType部分,由portType元素定义,可以包含多个operation子元素><!-整个portType部分,就相当于描述了方法string HelloWorld()DataSet GetDataSet(st

18、ring safeSql),int executeSQL(string sql) >- <wsdl:operation name="HelloWorld">  <wsdl:input message="tns:HelloWorldSoapIn" />   <wsdl:output message="tns:HelloWorldSoapOut" /> </wsdl:operation>- <wsdl:operation name="GetDataS

19、et"><!-portType部分,包含的operation子元素GetDataSet ><wsdl:input message="tns:GetDataSetSoapIn" /> <wsdl:output message="tns:GetDataSetSoapOut" /> <!-operation元素下 input和output子元素的message属性引用message部分的message元素 > </wsdl:operation>- <wsdl:operation

20、name="executeSQL"><!-portType部分,包含的operation子元素executeSQL ><wsdl:input message="tns:executeSQLSoapIn" />   <wsdl:output message="tns:executeSQLSoapOut" /><!-operation元素下 input和output子元素的message属性引用message部分的message元素 > </wsdl:operation

21、>  </wsdl:portType><!-binding部分的第一个binding元素 名为ServiceSoap ,绑定的portType为ServiceSoap ->- <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">  <soap:binding transport="/soap/http" /> <!- 元素指定的SOAP消息的网络协

22、议->- <wsdl:operation name="HelloWorld">  <soap:operation soapAction="/HelloWorld" style="document" /> - <wsdl:input>  <soap:body use="literal" />   </wsdl:input>- <wsdl:output>  <so

23、ap:body use="literal" />   </wsdl:output>  </wsdl:operation>- <wsdl:operation name="GetDataSet">  <soap:operation soapAction="/GetDataSet" style="document" /> <!- opertion元素中的soapAction属性,它的值是一个URL&

24、gt;- <wsdl:input>  <soap:body use="literal" />   </wsdl:input>- <wsdl:output>  <soap:body use="literal" />   </wsdl:output>  </wsdl:operation>- <wsdl:operation name="executeSQL">  <soap:ope

25、ration soapAction="/executeSQL" style="document" /> - <wsdl:input>  <soap:body use="literal" /> <! wsdl文档端口输入框架结构-> </wsdl:input>- <wsdl:output>  <soap:body use="literal" /> <!wsdl文档端口输出框架结构-

26、> </wsdl:output>  </wsdl:operation>  </wsdl:binding><!-binding部分的第二个binding元素 名为ServiceSoap12 ,绑定的portType为ServiceSoap ->- <wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap"><!定义端口名称和类型,将服务访问点的抽象定义与SOAP HTTP绑定->  <so

27、ap12:binding transport="/soap/http" /> - <wsdl:operation name="HelloWorld">  <soap12:operation soapAction="/HelloWorld" style="document" /> <!定义了一个操作”HelloWorld”方法的访问入口为”/HelloWo

28、rld”->- <wsdl:input>  <soap12:body use="literal" /> <! wsdl文档端口输入框架结构-> </wsdl:input>- <wsdl:output>  <soap12:body use="literal" /> <!wsdl文档端口输出框架结构-></wsdl:output>  </wsdl:operation>- <wsdl:operation name

29、="GetDataSet">  <soap12:operation soapAction="/GetDataSet" style="document" /> <!定义了一个操作”HelloWorld”方法的访问入口为”/GetDataSet”->- <wsdl:input>  <soap12:body use="literal" /> <! wsdl文档端口输入框架结构

30、->  </wsdl:input>- <wsdl:output>  <soap12:body use="literal" /> <!wsdl文档端口输出框架结构->  </wsdl:output>  </wsdl:operation>- <wsdl:operation name="executeSQL">  <soap12:operation soapAction="/executeSQL" style="document" /> <!定义了一个操作”HelloWorld”方法的访问入口为”/executeSQL”->- <wsd

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论