Chapter 3. Defining Logical Messages Used by a Service
Abstract
message element. The messages are made up of one or more parts that are defined using part elements.
Overview
message element in your contracts. Each logical message consists of one or more parts, defined in part elements.
Messages and parameter lists
Message design for integrating with legacy systems
types element of the contract. Your input message contains one part for each input parameter in the method. Your output message contains one part for each output parameter, plus a part to represent the return value, if needed. If a parameter is both an input and an output parameter, it is listed as a part for both the input message and the output message.
Message design for SOAP services
types element of the contract. The wrapper element has the following characteristics:
- It is a complex type containing a sequence of elements. For more information see Section 2.5, “Defining complex data types”.
- If it is a wrapper for an input message:
- It has one element for each of the method’s input parameters.
- Its name is the same as the name of the operation with which it is associated.
- If it is a wrapper for an output message:
- It has one element for each of the method’s output parameters and one element for each of the method’s inout parameters.
- Its first element represents the method’s return parameter.
- Its name would be generated by appending
Responseto the name of the operation with which the wrapper is associated.
Message naming
- Messages should only be used by a single operation.
- Input message names are formed by appending
Requestto the name of the operation. - Output message names are formed by appending
Responseto the name of the operation. - Fault message names should represent the reason for the fault.
Message parts
part element, and is identified by a name attribute and either a type attribute or an element attribute that specifies its data type. The data type attributes are listed in Table 3.1, “Part data type attributes”.
Table 3.1. Part data type attributes
foo, that is passed by reference or is an in/out, it can be a part in both the request message and the response message, as shown in Example 3.1, “Reused part”.
Example 3.1. Reused part
<message name="fooRequest"> <part name="foo" type="xsd:int"/> <message> <message name="fooReply"> <part name="foo" type="xsd:int"/> <message>
Example
Example 3.2. personalInfo lookup method
personalInfo lookup(long empId)
Example 3.3. RPC WSDL message definitions
<message name="personalLookupRequest"> <part name="empId" type="xsd:int"/> <message/> <message name="personalLookupResponse> <part name="return" element="xsd1:personalInfo"/> <message/>
Example 3.4. Wrapped document WSDL message definitions
<wsdl:types>
<xsd:schema ... >
...
<element name="personalLookup">
<complexType>
<sequence>
<element name="empID" type="xsd:int" />
</sequence>
</complexType>
</element>
<element name="personalLookupResponse">
<complexType>
<sequence>
<element name="return" type="personalInfo" />
</sequence>
</complexType>
</element>
</schema>
</types>
<wsdl:message name="personalLookupRequest">
<wsdl:part name="empId" element="xsd1:personalLookup"/>
<message/>
<wsdl:message name="personalLookupResponse">
<wsdl:part name="return" element="xsd1:personalLookupResponse"/>
<message/>
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.