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

SOAP 1.1 Message Styles and Encoding Options

This section describes the SOAP message styles, document vs. rpc, and encoding options, literal vs. encoded. Message style is specified using style='rpc|document' attribute. Message encoding option is specified using use='literal|encoded' attribute.

If you use SOAP 1.1 to exchange messages between the client and the server, you need to decide what message style to use and whether the message is encoded or not.

There are 2 message styles are supported by SOAP 1.1:

  • document - A specifically structured XML document will be used as the content of the SOAP Body. This style allows any type of messages to be exchanged.
  • rpc - A simple XML element with sub elements as positioned parameters will be used as the content of the SOAP Body. This style allows input and output parameters to be exchanged for a RPC (Remote Procedure Call).

Here are rules on how to specify SOAP message style with WSDL 1.1 Binding Extension for SOAP 1.1:

<!-- Message style can be specified at the binding level -->
    <soap:binding style="rpc|document" .../>
    
<!-- Message style can be specified at the operating level -->
<!-- Operating level setting overrides the binding level -->
      <soap:operation style="rpc|document" .../>

<!-- Default is "document" -->

There are 2 message encoding options are supported by SOAP 1.1:

  • literal - Messages will be exchanged as is without any type information included.
  • encoded - Messages will be exchanged as typed (encoded) with type information included.

Here is rule on how to specify SOAP message encoding option with WSDL 1.1 Binding Extension for SOAP 1.1:

<!-- Encoding option must be specified for SOAP Body -->
        <soap:body use="literal|encoded" .../>

<!-- Encoding option must be specified for SOAP Fault -->
        <soap:fault use="literal|encoded" .../>
    
<!-- Encoding option must be specified for SOAP Header -->
        <soap:header use="literal|encoded" .../>
        
<!-- Encoding option must be specified for SOAP Header Fault -->
        <soap:headerfault use="literal|encoded" .../>

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

 soapUI 3.0.1 - Web Service Testing Tool

WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles

SOAP 1.1 Message Styles and Encoding Options

 First Example - Hello

 Request and Response - Hello

 document/literal Example - Guest Registration

 Request and Response - Guest Registration

 rpc/encoded Example - Get Exchange Rate

 Request and Response - Get Exchange Rate

 SOAP Body and Operation Name - Book Reservation

 Request and Response - Book Reservation

 elementFormDefault="qualified" - Refill Order

 Request and Response - Refill Order

 encodingStyle="uri" for use="encoded"

 Request and Response - Get Stock Price

 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

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2013
SOAP 1.1 Message Styles and Encoding Options