WSDL Tutorials - Herong's Tutorial Examples - Version 2.01, by Dr. Herong Yang

"soap:body" - Binding for SOAP Body

This section describes 'soap:body', a SOAP extension element that specifies how the SOAP Body should be constructed in the SOAP message for an operation input and output. 'literal' means no encoding.

"soap:body" is a SOAP extension element used as a sub element of the "wsdl:input" or "wsdl:output" element inside the "wsdl:binding" and "wsdl:operation" element structure. "soap:body" is used to provide information on how the content of the SOAP Body element is constructed. The syntax of "soap:body" looks like this:

<wsdl:definitions ...>
  <wsdl:binding ...>
    <wsdl:operation ...>
        <soap:body parts="nmtokens" use="literal|encoded"
          encodingStyle="uri-list" namespace="uri"/>
        <soap:body parts="nmtokens" use="literal|encoded"
          encodingStyle="uri-list" namespace="uri"/>

Notes on the "soap:body" element:

  • parts="nmtokens" - Indicates with part or parts defined in the input or output message (specified through the "wsdl:portType" element) are used to construct this SOAP Body. If not provided, all parts are used.
  • use="literal|encoded" - Indicates whether the message part(s) should be used as is (literal) or encoded. This is a required attribute. If use="literal", the message part(s) are referring to concrete schema definition(s) and no encoding is needed. If use="encoded", the message part(s) are referring to abstract schema definition(s) and concrete message can be produced by applying the specified encoding style.
  • encodingStyle="uri-list" - Indicates encoding style(s) to be used in case of use="encoded".
  • namespace="uri" - Indicates the namespace to be used in case of use="encoded".

Here is an example of "soap:operation" element:

  <wsdl:binding name="helloBinding" type="hy:helloPortType">
    <soap:binding style="document"
    <wsdl:operation name="Hello">
      <wsdl:input name="helloInput">
        <soap:body use="literal"/>
      <wsdl:output name="helloOutput">
        <soap:body use="literal"/>

In this example,

  • use="literal" indicates that no encoding is needed. My message parts for "helloInput" and "helloOutput" have concrete schema definitions.
  • parts="nmtokens" is not specified. So all message parts defined for "helloInput" should be used to construct the SOAP Body for the SOAP request. Add all message parts defined for "helloOutput" should be used to construct the SOAP Body for the SOAP response.

Last update: 2007.

Table of Contents

 About This Book

 Introduction to WSDL 2.0

 WSDL 2.0 Document Structure and Syntax

 WSDL Version 2.0 Part 2: Adjuncts

 WSDL 2.0 Document Examples with SOAP Binding

 WSDL 20 Programming APIs and Testing Tools

 Introduction to WSDL 1.1

 WSDL 1.1 Document Structure and Syntax

WSDL 1.1 Binding Extension for SOAP 1.1

 What Is WSDL 1.1 SOAP Extension?

 "soap:binding" - Binding Message Style and Transportation

 "soap:operation" - SOAPAction Header Line

"soap:body" - Binding for SOAP Body

 "soap:fault" - Binding for SOAP Fault Details

 "soap:header" - Binding for SOAP Header

 "soap:address" - Location of Service

 soapUI 3.0.1 - Web Service Testing Tool

 WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles

 PHP SOAP Extension in PHP 5.3.1

 Using WSDL in Perl with SOAP::Lite 0.710

 Using WSDL Document in Java with Axis2 1.4.1

 Using WSDL2Java to Generate Web Service Stub Classes

 WSDL 1.1 Binding Extension for SOAP 1.2

 WSDL 1.1 and SOAP 1.2 Examples - Document and RPC Styles

 SOAP 1.2 Binding - PHP, Java and Perl Clients

 WSDL Related Terminologies


 PDF Printing Version

"soap:body" - Binding for SOAP Body - Updated in 2013, by Dr. Herong Yang