XML模式:WSD

所属分类: 网页制作 / XML/XSLT 阅读数: 631
收藏 0 赞 0 分享

Web 服务描述语言(Web Services Description Language,WSDL)提供了一种描述 Web 服务(大多使用 SOAP)的简单方法。WSDL 允许您描述利用 SOAP 标准所提供的服务和接口。
比方说,可以创建描述某台服务器上提供的服务的 WSDL 文件,然后把该文件分发给需要这些服务的 Web 服务消费者。通过阅读和解析 WSDL 文件,消费者能够了解到使用这些 Web 服务需要知道的所有信息,包括可以交换的数据类型、参数以及返回的各种错误和其他信息。
再次使用来自 W3C 的例子,可以看到不同远程函数的声明和交换的数据都是通过结构的 XML 定义处理的,如清单 3 所示。
清单 3. 不同远程函数和交换数据的 XML 定义

<?xml version="1.0"?> <!-- root element wsdl:definitions defines set of related services --> <wsdl:definitions name="EndorsementSearch" targetNamespace="http://namespaces.snowboard-info.com" xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl" xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"> <!-- wsdl:types encapsulates schema definitions of communication types; here using xsd --> <wsdl:types> <!-- all type declarations are in a chunk of xsd --> <xsd:schema targetNamespace="http://namespaces.snowboard-info.com" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <!-- xsd definition: GetEndorsingBoarder [manufacturer string, model string] --> <xsd:element name="GetEndorsingBoarder"> <xsd:complexType> <xsd:sequence> <xsd:element name="manufacturer" type="string"/> <xsd:element name="model" type="string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <!-- xsd definition: GetEndorsingBoarderResponse [... endorsingBoarder string ...] --> <xsd:element name="GetEndorsingBoarderResponse"> <xsd:complexType> <xsd:all> <xsd:element name="endorsingBoarder" type="string"/> </xsd:all> </xsd:complexType> </xsd:element> <!-- xsd definition: GetEndorsingBoarderFault [... errorMessage string ...] --> <xsd:element name="GetEndorsingBoarderFault"> <xsd:complexType> <xsd:all> <xsd:element name="errorMessage" type="string"/> </xsd:all> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <!-- wsdl:message elements describe potential transactions --> <!-- request GetEndorsingBoarderRequest is of type GetEndorsingBoarder --> <wsdl:message name="GetEndorsingBoarderRequest"> <wsdl:part name="body" element="esxsd:GetEndorsingBoarder"/> </wsdl:message> <!-- response GetEndorsingBoarderResponse is of type GetEndorsingBoarderResponse --> <wsdl:message name="GetEndorsingBoarderResponse"> <wsdl:part name="body" element="esxsd:GetEndorsingBoarderResponse"/> </wsdl:message> <!-- wsdl:portType describes messages in an operation --> <wsdl:portType name="GetEndorsingBoarderPortType"> <!-- the value of wsdl:operation eludes me --> <wsdl:operation name="GetEndorsingBoarder"> <wsdl:input message="es:GetEndorsingBoarderRequest"/> <wsdl:output message="es:GetEndorsingBoarderResponse"/> <wsdl:fault message="es:GetEndorsingBoarderFault"/> </wsdl:operation> </wsdl:portType> <!-- wsdl:binding states a serialization protocol for this service --> <wsdl:binding name="EndorsementSearchSoapBinding" type="es:GetEndorsingBoarderPortType"> <!-- leverage off soap:binding document style ...(no wsdl:foo pointing at the soap binding) --> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <!-- semi-opaque container of network transport details classed by soap:binding above ... --> <wsdl:operation name="GetEndorsingBoarder"> <!-- again bind to SOAP? ... --> <soap:operation soapAction="http://www.snowboard-info.com/ EndorsementSearch"/> <!-- further specify that the messages in the wsdl:operation "GetEndorsingBoarder" use SOAP? ... --> <wsdl:input> <soap:body use="literal" namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> </wsdl:input> <wsdl:output> <soap:body use="literal" namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> </wsdl:output> <wsdl:fault> <soap:body use="literal" namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/> </wsdl:fault> </wsdl:operation> </wsdl:binding> <!-- wsdl:service names a new service "EndorsementSearchService" --> <wsdl:service name="EndorsementSearchService"> <wsdl:documentation>snowboarding-info.com Endorsement Service</ wsdl:documentation> <!-- connect it to the binding "EndorsementSearchSoapBinding" above --> <wsdl:port name="GetEndorsingBoarderPort" binding="es:EndorsementSearchSoapBinding"> <!-- give the binding an network address --> <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/> </wsdl:port> </wsdl:service> </wsdl:definitions>

WSDL 声明了消息类型、默认数据类型和内容以及交换的数据结构。
访问服务器上 SOAP 结构需要使用的一切信息都可以在这个 WSDL 中找到。大多数语言和环境都提供一种阅读和解析 WSDL 的机制,以确定可用的函数和数据交换。
WSDL 不仅定义了用于交换信息的 SOAP 接口,通过适当的 WSDL 生成程序,还可用于创建发送请求、生成并格式化响应所需要的代码。
WSDL 和 SOAP 组成了一个强大的远程过程调用系统。
更多精彩内容其他人还在看

网页制作关于代码的18个小技巧

  1、xml文件尽量以utf-8编码,gb2312有些字是存储不了的,如?,就算能存也需要转换,比较麻烦,utf-8也符合国际规范。   2、CSS中:hover这个伪类,如果放在:visited前面则会失效。   3、<a>标签如果没有href属性,所
收藏 0 赞 0 分享

什么是XML?

XML是 EXtensible Markup Language(可扩展标识语言)的简写。 和HTML(Hypertext Markup Language 超文本标记语言)一样,同样来源于SGML. XML 不是 HTML 的替代者,只是HTML的补充,它的用途完全不同
收藏 0 赞 0 分享

数据库生成xml的简单方法

第一个示例方法: 1 SqlConnection conn = new SqlConnection(); 2 conn.ConnectionString = "Server=127.0.0.1;User ID=sa;Password=fdahgdr
收藏 0 赞 0 分享

XML教程:通过一个例子来学习XML的语法

XML的语法规则既很简单,又很严格。这些规则很容易学习,也很容易使用。 正因为如此,创建可读取及操作XML的软件不是一件难事。 一个XML文档的例子 XML使用一种可自我描述的简单的语法。 <?xml version="1.0&q
收藏 0 赞 0 分享

百度新闻开放协议XML文档制作方法简述

开放协议概述 使用此开放协议,将会为您的网站带去更多流量! 《互联网新闻开放协议》是百度新闻搜索制定的搜索引擎新闻源收录标准,网站可将发布的新闻内容制作成遵循此开放协议的XML格式的网页(独立于原有的新闻发布形式)供搜索引擎索引,将网站发布的新闻信息主动、及
收藏 0 赞 0 分享

XML教程:XML有哪些用途?

XML是被设计为存储、传输以及交换数据的。XML不是被设计为用来显示数据的。 XML可以将HTML与数据分离 通过使用XML,您的数据可存储于HTML之外。 当我们使用HTML来显示数据时,数据存储于HTML中。通过使用XML,数据可以被存储在单独的X
收藏 0 赞 0 分享

XML教程:什么是XML及XML和HTML的区别

XML被设计用来描述数据,其焦点是数据的内容。 HTML被设计用来显示数据,其焦点是数据的外观。 应该掌握的基础知识: 在您继续学习之前,需要对以下知识有基本的了解: HTML / XHTML JavaScript or
收藏 0 赞 0 分享

XML中的DTD文档类型定义完全解析

XML标签的自定义功能非常强大,比如本文将要讲解的DTD(Document Type Definition)就带给人们一种面向对象般的感觉,well,下面就来看一下XML中的DTD文件类型定义完全解析
收藏 0 赞 0 分享

了解WEB页面工具语言XML(三)支持工具

三、支持XML的公司和它们的开发工具   尽管XML还处在开发阶段,其标准正在由W3C组织制定,但是已经有许多公司表示全力支持XML,并开发了不少XML工具。Adobe公司的FrameMaker可以用来书写XML文档。Microsoft公司推出的IE 4.0已经可以显示、
收藏 0 赞 0 分享

了解WEB页面工具语言XML(四)应用分类

四、XML应用分类   总的说来的XML的应用可分为四类:   (1)应用于客户需要与不同的数据源进行交互时。数据可能来自不同的数据库,他们都有各自不同的复杂格式。但客户与这些数据库间只通过一种标准语言进行交互,那就是XML。由于XML的自定义性及可扩展性,它
收藏 0 赞 0 分享
查看更多