Open In App

WSDL <message> Element

Last Updated : 16 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

WSDL <message> Element is used to describe the data that is exchanged between the Web Service providers and the consumers. There are two messages per Web Service input and output. The input describes parameters for the web service and the output describes the return data from the Web Service.

WSDL <message> Element contains one or more than one WSDL <part> Element element. Each part parameter has a concrete type associated with it that is specified in the type container element.

Syntax:

<message name = "...">
<part/>
</message>

The below examples will illustrate the WSDL <message> Element:

Example 1: In this example, we will define one message element that will represent a request message AccessRequest. AccessRequest message contains one part, a zip code of type xsd:string. The client request thus provides a zip code to the server.

HTML




<message name = "AccessRequest">
   <part name = "zipcode" type = "xsd:string"/>
</message>


We have defined a message element named “AcessRequest” which tells us a request message. The “AccessRequest” message contains one part named “zipcode” of type “xsd:string.” This part signifies that the client request provides a zip code as input to the server.

Example 2: In this example, we will define two message elements that will represent a request message AccessRequest, and a response message AccessResponse.

HTML




<message name = "AccessRequest">
   <part name = "zipcode" type = "xsd:string"/>
</message>
 
<message name = "AccessResponse">
   <part name = "zipcode" type = "xsd:string"/>
</message>


In this second example, we define two message elements: “AccessRequest” and “AccessResponse.” The “AccessRequest” message is for request data, and the “AccessResponse” message is for response data. Both messages contain a part named “zipcode” of type “xsd:string.”

In summary, the WSDL <message> element is essential for describing the structure of data exchanged between web service providers and consumers. It allows you to define the parameters and data elements within a message, ensuring clear communication between the client and the server.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads