当前位置: 首页 > 网络学院 > XML相关教程 > WSDL > WSDL 文档

WSDL
WSDL 介绍
WSDL 文档
WSDL 端口
WSDL 绑定
WSDL 与 UDDI
WSDL 语法
WSDL 摘要

WSDL 文档


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 684 ::
收藏到网摘: n/a

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

It contains set of definitions to describe a web service.
它包含了一系列描述web service的定义。


The WSDL Document Structure
WSDL文档结构

A WSDL document describes a web service using these major elements:
WSDL 文档是利用这些主要的元素来描述某个 web service 的:

Element
元素
Defines
定义
<portType> The operations performed by the web service
web service 执行的操作
<message> The messages used by the web service
web service 使用的消息
<types> The data types used by the web service
web service 使用的数据类型
<binding> The communication protocols used by the web service
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 元素,此元素可把若干个 web services 的定义组合在一个单一的 WSDL 文档中。

For a complete syntax overview go to the chapter WSDL Syntax.
如需完整的语法概述,请访问WSDL 语法


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.
它可描述一个 web service、可被执行的操作,以及相关的消息。

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>元素定义 web service 使用的数据类型。

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


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>元素定义了每个元素部件以及相关的数据类型。

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 的一个函数。

评论 (0) All

登陆 | 还没注册?