WSDL 文档

来源:互联网 发布:审计入门书籍推荐 知乎 编辑:程序博客网 时间:2024/05/17 05:14

 WSDL 文档

作者:w3pop.com 翻译/整理:w3pop.com
<script type="text/javascript"><!--google_ad_client = "pub-7906861952969058";google_alternate_color = "ffffff";google_ad_width = 468;google_ad_height = 60;google_ad_format = "468x60_as";google_ad_type = "text_image";google_ad_channel = "";google_color_border = "FFFFFF";google_color_bg = "FFFFFF";google_color_link = "006699";google_color_text = "EEEEEE";google_color_url = "FFFFFF";//--></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>

A WSDL document is just a simple XML document.
一份WSDL文档是一份简单的XML文档。

It contains set of definitions to describe a web service.
它包含了几组用于描述网页服务的定义。


The WSDL Document Structure
WSDL文档结构

A WSDL document describes a web service using these major elements:
一份WSDL文档用到这些重要元素来描述网页服务:

Element
元素 Defines
定义 <portType> The operations performed by the web service
由网页服务进行的操作 <message> The messages used by the web service
网页服务使用的信息 <types> The data types used by the web service
网页服务使用的数据类型 <binding> The communication protocols used by the web service
网页服务使用的交流协议

The main structure of a WSDL document looks like this:
一份WSDL文档的主要结构会像这样:

<definitions>
<types>
definition of types........
</types>

<message>
definition of a message....
</message>

<portType>
definition of a port.......
</portType>

<binding>
definition of a binding....

</binding>

</definitions>

A WSDL document can also contain other elements, like extension elements and a service element that makes it possible to group together the definitions of several web services in one single WSDL document.
一份WSDL文档可能也会包含其他元素,像extension(扩展)元素和service(服务)元素,service元素可以把若干个网页服务的定义合在一起放在一份单独的WSDL文档里。

For a complete syntax overview go to the chapter WSDL Syntax.
想了解关于全部语法,请阅读WSDL Syntax.这章。


WSDL Ports
WSDL端口

The <portType> element is the most important WSDL element.
<portType>元素是最重要的WSDL元素

It describes a web service, the operations that can be performed, and the messages that are involved.
它描述了网页服务,可进行的操作,以及涉及到的信息。

The <portType> element can be compared to a function library (or a module, or a class) in a traditional programming language.
<portType>元素可以比喻为传统设计语言里的函数库(或一个模块,一个类)


WSDL Messages
WSDL信息

The <message> element defines the data elements of an operation.
<message>元素定义了一项操作的数据元素。

Each message can consist of one or more parts. The parts can be compared to the parameters of a function call in a traditional programming language.
每条信息都由一部分或几部分组成。这些部分可比作是在传统设计语言里被调用的函数的参数。


WSDL Types
WSDL类型

The <types> element defines the data type that are used by the web service.
<types>元素定义了被网页服务所用的数据类型。

For maximum platform neutrality, WSDL uses XML Schema syntax to define data types.
为了最大限度的平台中立,WSDL用XML格式语法来定义数据类型。


WSDL Bindings
WSDL 捆绑

The <binding> element defines the message format and protocol details for each port.
<binding>元素为每个端口定义了信息格式化和协议细节。


WSDL Example
WSDL举例

This is a simplified fraction of a WSDL document:
下面是一份WSDL文档的简化了的片段:

<message name="getTermRequest">

<part name="term" type="xs:string"/>
</message>

<message name="getTermResponse">
<part name="value" type="xs:string"/>

</message>
<portType name="glossaryTerms">
<operation name="getTerm">
<input message="getTermRequest"/>
<output message="getTermResponse"/>
</operation>
</portType>

In this example the <portType> element defines "glossaryTerms" as the name of a port, and "getTerm" as the name of an operation.
在这个例子里<portType>元素把"glossaryTerms"定义为一个端口的名称,"getTerm"定义为一项操作的名称。

The "getTerm" operation has an input message called "getTermRequest" and an output message called "getTermResponse".
"getTerm"操作有一条"getTermRequest"的输入信息和一条"getTermResponse".的输出信息

The <message> elements define the parts of each message and the associated data types.
<message>元素定义了每条元素的部分(part)和相联系的数据类型。

Compared to traditional programming, glossaryTerms is a function library, "getTerm" is a function with "getTermRequest" as the input parameter and getTermResponse as the return parameter.
与传统程序设计相比,glossaryTerms是个函数库,"getTerm"是个以"getTermRequest"作为输入参数,getTermResponse作为输出参数的函数

<script type="text/javascript"><!--google_ad_client = "pub-7906861952969058";google_alternate_color = "ffffff";google_ad_width = 468;google_ad_height = 60;google_ad_format = "468x60_as";google_ad_type = "text_image";google_ad_channel = "";google_color_border = "FFFFFF";google_color_bg = "FFFFFF";google_color_link = "006699";google_color_text = "EEEEEE";google_color_url = "FFFFFF";//--></script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
 
原创粉丝点击