您好,欢迎访问一九零五行业门户网

XML模式-WSD的描述

web 服务描述语言(web services description language,wsdl)提供了一种描述 web 服务(大多使用 soap)的简单方法。wsdl 允许您描述利用 soap 标准所提供的服务和接口。 比方说,可以创建描述某台服务器上提供的服务的 wsdl 文件,然后把该文件分发给需要这些服务的 w
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模式-wsd的描述的详细内容。
其它类似信息

推荐信息