The <portType> element is the most important WSDL element.
The <portType> element defines a web service, the operations that can be performed, and the messages that are involved.
<portType> 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.
The request-response type is the most common operation type, but WSDL defines four types:
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 |
A one-way operation example:
In the example above, the portType "glossaryTerms" defines a one-way operation called "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.
A request-response operation example:
In the example above, the portType "glossaryTerms" defines a request-response operation called "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".