WSDL 端口
作者:w3pop.com 翻译/整理:w3pop.comA WSDL port describes the interfaces (legal operations) exposed by a web service.
WSDL端口描述了由网页服务所揭示的界面(interface)(合法操作)
WSDL Ports
WSDL端口
The <portType> element is the most important WSDL element.
<portType>元素是最重要的WSDL元素。
It defines a web service, the operations that can be performed, and the messages that are involved.
它定义了网页服务,可进行的操作,以及涉及到的信息。
The port defines the connection point to a web service. It can be compared to a function library (or a module, or a class) in a traditional programming language. Each operation can be compared to a function in a traditional programming language.
端口定义了与网页服务的连接点。它可以比作是传统设计语言里的函数库(或一块模板,或一个类)。每项操作可比成是传统设计语言里的一个函数。
Operation Types
操作类型
The request-response type is the most common operation type, but WSDL defines four types:
请求—回操作类型是最常见的操作类型,但WSDL定义的有四种:
Type 类型 | Definition 定义 |
---|---|
One-way | The operation can receive a message but will not return a response 可接受信息但不回复的操作 |
Request-response | The operation can receive a request and will return a response 接受并回复信息的操作 |
Solicit-response | The operation can send a request and will wait for a response 可发出请求并会等待回复的操作 |
Notification | The operation can send a message but will not wait for a response 可发出信息但不会等待回复的操作 |
One-Way Operation
单向操作
A one-way operation example:
单向操作的例子:
<message name="newTermValues"> <portType name="glossaryTerms"> |
In this example the port "glossaryTerms" defines a one-way operation called "setTerm".
在这个例子里"glossaryTerms端口定义了称作"setTerm".的单向操作
The "setTerm" operation allows input of new glossary terms messages using a "newTermValues" message with the input parameters "term" and "value". However, no output is defined for the operation.
"setTerm"操作允许利用输入参数为“term"和"value"的名为"newTermValues"的信息进行大量全新条款信息的输入。 但是,这项操作没有定义有关输出的内容。
Request-Response Operation
请求—回复 操作
A request-response operation example:
一个“请求—回复”操作的例子:
<message name="getTermRequest"> <portType name="glossaryTerms"> |
In this example the port "glossaryTerms" defines a request-response operation called "getTerm".
这个例子里端口"glossaryTerms"定义了一个名为"getTerm"的“请求—回复”操作
The "getTerm" operation requires an input message called "getTermRequest" with a parameter called "term", and will return an output message called "getTermResponse" with a parameter called "value".
"getTerm"操作需要一个参数为"term"的名为"getTermRequest"的输入信息,并且会返回一条参数为"value".的名为“etTermResponse"的输出信息