What Is SOAP Encoding

This section provides a quick description of SOAP Encoding and samples of serializing simple and compound value nodes.

SOAP Encoding is an extension of the SOAP framework specification that defines how a data value should be encoded in an XML format. SOAP Data Model is defined as an adjunct in SOAP 1.2 specification.

SOAP encoding offers the following rules to convert any data value defined in SOAP data model into XML format. Converting a data value into XML format is called serialization or encoding.

Rule 1. A simple value node with a labeled inbound edge will be serialized into a single XML element with the edge's label as the element's name and node value as the element's text content.

Rule 2. When serializing a node into an XML element, an "xsi:type" attribute can be added to specify the value type of this note. For more information on "xsi:type", see the other sections in this book.

Rule 3. A compound value node with labeled outbound edges, a data structure, will be serialized into a single XML element with child elements. One outbound edge will be serialized into one child element with element's name equal to the edge's label. The order of child elements is not significant.

Rule 4. A compound value node with non-labeled outbound edges, a data array, will be serialized into a single XML element with child elements. One outbound edge will be serialized into one child element with element's name equal to any label as long as it's the same for all child elements. The order of child elements signifies the position values of outbound edges.

Rule 5. When serializing an array, an "enc:itemType" attribute can be added to specify the value type of its sub nodes, and an "enc:arraySize" attribute can be added to specify the number of values in the array.

Example 1 - Simple value with no reference: The following graph represents a simple value of 3.14:

   (3.14)

Since this node has no inbound edge, I guess we can serialize it as XML element with any name:

   <value>3.14</value>

Example 2 - Simple value with a named reference: The following graph represents a simple value of 3.14 with a reference name of "pi":

   --- pi -->(3.14) 

This node has an inbound labeled edge. The resulting XML element should be named as the inbound edge label.

   <pi>3.14</pi>

Example 3 - Compound value with named sub data elements: The following graph represents a compound value with a reference name of "currentCustomer". This compound value has 3 simple-value sub data elements referenced as "id", "name" and "isSmoking" respectively. In many programming language, this compound value is called a structure:

                         (2321)
                           ^
                           |
                          id
                           |
   --- currentCustomer -->( )-- name -->(Herong)
                           |
                       isSmoking
                           |
                           v
                        (false)

This node has an inbound labeled edge. The resulting XML element should be named as the inbound edge label:

   <currentCustomer>
    <id>2321</id>
    <name>Herong</name>
    <isSmoking>false</isSmoking>
   </currentCustomer>

Example 4 - Compound value with positioned sub data elements: The following graph represents a compound value with a reference name of "colors". This compound value has 3 simple-value sub data elements referenced with no names, but with positions. In many programming languages, this compound value is called an array:

                (Red)
                  ^
                  |
                  0
                  |
   --- colors -->( )----1--->(Green)
                  |
                  2
                  |
                  v
                (Blue)

Obviously, this node represents an array:

   <colors enc:arraySize="3" enc:itemType="xsd:string">
    <item>Red</item>
    <item>Green</item>
    <item>Blue</item>
   </colors>

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

 SOAP Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

SOAP Encoding

What Is SOAP Encoding

 Multiple References and Circular References

 Node Types - simple, struct, array

 SOAP Encoding Attributes and Namespace

 Using SOAP Encoding in SOAP Messages

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP MEP (Message Exchange Patterns)

 SOAP HTTP Binding

 SOAP PHP Implementations

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 PHP SOAP Web Service Example - getTemp

 SOAP Perl Implementations

 Perl SOAP::Lite - SOAP Server-Client Communication Module

 Perl Socket Test Program for HTTP and SOAP

 Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service

 Perl SOAP::Lite for SOAP 1.2 Web Services

 Perl SOAP::Lite for WSDL

 Python SOAP Client: Zeep

 SOAP Java Implementations

 Java Socket and HttpURLConnection for SOAP

 SAAJ - SOAP with Attachments API for Java

 SoapUI - SOAP Web Service Testing Tool

 WS-Security - SOAP Message Security Extension

 WS-Security X.509 Certificate Token

 Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service

 Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services

 Perl SOAP::Lite 0.710 for WSDL

 Web Services and SOAP Terminology

 Archived Tutorials

 References

 Full Version in PDF/EPUB