SOAP is defined as a one-way message transmission protocol. However, it is often necessary to transmit more than one message between the Web Service Client and the Web Service Provider, to cover a specific use case.
A message exchange pattern is a template that establishes a pattern for the exchange of messages between two communicating parties (SOAP nodes).
SOAP 1.2 defines two Message Exchange Pattern:
- Request-Response MEP
- SOAP Response MEP
Release 1.1 of the WSDL specification provides support for four Message Exchange Patterns:
- Request-Response: Upon receiving a message, the provider must respond with a standard message or a fault message.
- One-way: The provider expects a single message and is not obligated to respond.
- Solicit-Response: Upon submitting a message to a service requestor, the service expects a standard response message or a fault message.
- Notification: The service sends a message and expects no response.
Message Exchange Pattern in WSDL 2.0
A WSDL 2.0 document contains a message exchange pattern (MEP) that defines the way that SOAP 1.2 messages are exchanged between the web service requester and web service provider.
The following MEPs are defined in WSDL 2.0:
- In-Only: This is equivalent to one-way. A standard one-way messaging exchange where the consumer sends a message to the provider that provides only a status response.
- Robust In-Only: This pattern is for reliable one-way message exchanges. The consumer initiates with a message to which the provider responds with status. If the response is a status, the exchange is complete, but if the response is a fault, the consumer must respond with a status.
- In-Out: This is equivalent to request–response. A standard two-way message exchange where the consumer initiates with a message, the provider responds with a message or fault and the consumer responds with a status.
- In-Optional-Out: A standard two-way message exchange where the provider's response is optional.
- Out-Only: The reverse of In-Only. It primarily supports event notification. It cannot trigger a fault message.
- Robust-Out-Only: Similar to the out-only pattern, except it can trigger a fault message. The outbound message initiates the transmission.
- Out-In: The reverse of In-Out. The provider transmits the request and initiates the exchange. (Equivalent to the WSDL 1.1 solicit-response operation.)
- Out-Optional-In: The reverse of In-Optional-Out. The service produces an outbound message. The incoming message is optional ("Optional-in").
The following table compares WSDL 1.1, WSDL 2.0, and Communication Pattern:
Comparison WSDL 1.1, WSDL 2.0, Communication Pattern
|WSDL 1.1||WSDL 2.0||Communication Pattern|
|Solicit-Response||Out-In||Request-Response from Provider point of view|