WSDL - Message Exchange Patterns (MEP)
What is MEP?
Message Exchange Pattern (MEP) in WSDL defines how messages flow between a client (service consumer) and a web service (service provider).
It specifies the sequence and direction of messages for each operation in a portType
.
In simple terms:
-
PortType + Operations = What service can do
-
MEP = How messages are exchanged for those operations
Types of Message Exchange Patterns in WSDL
1. One-Way
-
Description: The client sends a request message, but the service does not send back a response.
-
Example: Logging service where the client sends log data.
-
Flow: Client → Service
<operation name="SubmitLog">
<input message="tns:LogMessage"/>
</operation>
2. Request-Response
-
Description: The most common MEP. The client sends a request message, and the service responds with a reply.
-
Example: Weather service where the client sends a city name and gets the forecast.
-
Flow: Client → Service → Client
<operation name="GetWeather">
<input message="tns:GetWeatherRequest"/>
<output message="tns:GetWeatherResponse"/>
</operation>
3. Solicit-Response
-
Description: The service initiates communication by sending a request, and the client replies.
-
Example: A stock trading service might solicit updated portfolio data from the client.
-
Flow: Service → Client → Service
<operation name="SolicitPortfolioUpdate">
<output message="tns:PortfolioRequest"/>
<input message="tns:PortfolioResponse"/>
</operation>
4. Notification
-
Description: The service sends a message to the client, but no response is expected.
-
Example: A news service pushing breaking news alerts.
-
Flow: Service → Client
<operation name="BreakingNews">
<output message="tns:NewsMessage"/>
</operation>
Summary Table: WSDL MEPs
MEP Type | Initiator | Flow | Response Expected |
---|---|---|---|
One-Way | Client | Client → Service | No |
Request-Response | Client | Client → Service → Client | Yes |
Solicit-Response | Service | Service → Client → Service | Yes |
Notification | Service | Service → Client | No |