WSDL - Request-Response

1. What is Request-Response?

In WSDL and SOAP web services, a request-response operation is the most common communication pattern.

  • The client (service consumer) sends a request to the service provider.

  • The service provider processes the request.

  • The provider sends a response back to the client.

Analogy:
It’s like asking a question and getting an answer.


2. Request-Response in WSDL

In a WSDL portType definition, a request-response operation includes both <input> and <output> messages.

Example WSDL (Request-Response Operation)

<portType name="AccountServicePortType">
  <operation name="GetBalance">
    <input message="tns:GetBalanceRequest"/>
    <output message="tns:GetBalanceResponse"/>
  </operation>
</portType>
  • Input message: GetBalanceRequest → Sent by the client.

  • Output message: GetBalanceResponse → Returned by the service.


3. SOAP Request & Response Example

SOAP Request (Client → Service Provider)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:acc="http://bank.example.com/account">
   <soapenv:Header/>
   <soapenv:Body>
      <acc:GetBalanceRequest>
         <acc:accountID>101</acc:accountID>
      </acc:GetBalanceRequest>
   </soapenv:Body>
</soapenv:Envelope>

SOAP Response (Service Provider → Client)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:acc="http://bank.example.com/account">
   <soapenv:Header/>
   <soapenv:Body>
      <acc:GetBalanceResponse>
         <acc:balance>2500.75</acc:balance>
      </acc:GetBalanceResponse>
   </soapenv:Body>
</soapenv:Envelope>

4. Request-Response Workflow

  1. Client sends request → Based on WSDL definition.

  2. Service provider receives request → Processes business logic.

  3. Service provider sends response → In SOAP XML format.

  4. Client processes response → Uses returned data.


5. Use Cases for Request-Response

Request-response is used when the client needs confirmation or data from the server.

Examples

  • Banking services → Get account balance, transfer money.

  • E-commerce → Place order, get order status.

  • Weather services → Send location, receive forecast.

  • Authentication services → Send credentials, receive authentication token.


6. Request-Response vs One-Way

Feature Request-Response One-Way
Request Sent by client Sent by client
Response Returned by service No response
WSDL Input Yes Yes
WSDL Output Yes No
Example Use Balance check, order status Logging, notifications
HTTP Status Usually 200 OK Usually 202 Accepted

7. Real-Life Analogy

  • Request-Response:
    You call a customer support agent and ask about your bill → The agent gives you the answer.

  • One-Way:
    You send a complaint letter but don’t expect a reply.


8. Summary

  • Request-Response = Two-way communication.

  • The client sends a request and receives a response.

  • WSDL defines it with both <input> and <output>.

  • Used when the client needs a confirmation or data.