XML模式:WSD
所属分类:
网页制作 / XML/XSLT
阅读数:
666
收藏 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 组成了一个强大的远程过程调用系统。
初学XML的基础知识(认识XML的作用)
“可扩展标记语言”(XML) 提供一种描述结构化数据的方法。与主要用于控制数据的显示和外观的 HTML 标记不同,XML 标记用于定义数据本身的结构和数据类型。
XML 使用一组标记来描绘数据元素。每个元素封装可能十分简单也可能十分复杂的数据。您可
收藏 0赞 0分享
使用XML实现多渠道接入网站的构架
其实写这篇文章的目的最多的想法是把自己在去年在瑞士做项目时应用的一个框架给展现出来让大家共享,但我又有点担心我的表达能力不能将我在里面使用的思想很好的表现出来,所以迟迟 不敢下笔,最后还是下了决心,写吧, 不行就在好好改改,当然也希望大家多提些意见。
收藏 0赞 0分享
学习XML关于图像超链接的制作
这是我今天学习的时候遇到的另一个问题,做图像超链接要把链接地址放到<a>的href属性中去,可是这就是在标签中套标签,是不可以的,查了《Web编程实做教程》,才知道正确的解决方案,现在与大家分享。
此段代码运行需要两张图片:a.gif和b.gif。
my
收藏 0赞 0分享
Microsoft的XMLHTTP对象介绍
MSXML中提供了Microsoft.XMLHTTP对象,能够完成从数据包到Request对象的转换以及发送任务。
创建XMLHTTP对象的语句如下:
Set objXML = CreateObject("Msxml2.XMLHTTP") 或
Set
收藏 0赞 0分享
了解WEB页面工具语言XML(六)展望
六、XML展望
任何一项新技术的产生都是有其需求背景的,XML的诞生是在HTML遇到不可克服的困难之后。近年来HTML在许多复杂的Web应用中遇到了问题,要彻底解决这些问题,必须用功能强大的XML来替代HTML作为Web页面的书写工具。XML有利于信息的表达和结构化组
收藏 0赞 0分享
了解WEB页面工具语言XML(五)好处
五、XML带来的好处
(1)更有意义的搜索
数据可被XML唯一的标识。没有XML,搜索软件必须了解每个数据库是如何构建的。这实际上是不可能的,因为每个数据库描述数据都是不同的。有了XML,书就可以很容易以标准的方式按照作者、标题、ISBN序号或其他的标准分
收藏 0赞 0分享
用XML将机器内码转换为人们容易理解的信息
程序中通常会有一些错误代码或标识,为了程序中方便这些东西通常不会使用汉字,经常在程序中用的是一些FileError或数字。还有就是在编码中经常使用的枚举标识对象的状态。而通常这些信息会直接的或间接的现实给用户,可用户需要到的是容易理解的汉字描述。以前要么将这
收藏 0赞 0分享
历数Firefox2.0对XML处理的改进
Firefox 2.0 在对 XML 的支持方面有几个重要的改进。目前它的用户部署如日中天。了解 Firefox 2.0 XML 特性的改进,包括在 RSS Web 提要处理方面有争议的变化。
被赋予新应用程序平台的角色后,现在 Web 浏览器可能是最热门的软件。对于软件开
收藏 0赞 0分享
查看更多