WSDL - Purpose: Defines the input and output messages for operations
The statement "Purpose: Defines the input and output messages for operations" specifically refers to the <message>
element in a WSDL document.
WSDL <message>
Element
Purpose
The <message>
element defines the data exchanged between the client and the web service during an operation.
Each <message>
can represent:
-
Input messages → what the client sends to the service.
-
Output messages → what the service returns to the client.
-
Fault messages → error information, if any.
Structure
<message name="MessageName">
<part name="parameterName" type="xsd:dataType"/>
</message>
-
name → Unique name for the message.
-
part → Defines each parameter (input/output).
-
type → Refers to XML Schema data types (
xsd:string
,xsd:int
, etc.).
Example
<!-- Input message -->
<message name="GetOrderRequest">
<part name="orderId" type="xsd:string"/>
</message>
<!-- Output message -->
<message name="GetOrderResponse">
<part name="orderDetails" type="xsd:string"/>
</message>
Here:
-
GetOrderRequest
→ input message containingorderId
. -
GetOrderResponse
→ output message containingorderDetails
.
How <message>
Connects to Operations
The <message>
elements are used in the <portType>
section to define which messages are used for each operation.
<portType name="OrderPortType">
<operation name="GetOrder">
<input message="tns:GetOrderRequest"/>
<output message="tns:GetOrderResponse"/>
</operation>
</portType>
-
The operation
GetOrder
uses:-
GetOrderRequest
as input. -
GetOrderResponse
as output.
-
Summary Table
Aspect | Details |
---|---|
Element | <message> |
Purpose | Defines input, output, and fault messages |
Used In | <portType> operations |
Attributes | name , <part> |
Example | GetOrderRequest , GetOrderResponse |