Herong's Tutorial Notes on Web Service and SOAP
Dr. Herong Yang, Version 4.00

Multiple References and Circular References

This section describes how SOAP Encoding handles multiple references and circular references.

To help serializing multiple reference, SOAP encoding specification offers the following rule:

Rule 6. When serializing an labeled inbound edge, "enc:id" attribute can be added to provide an identification to the node. If this node has other labeled inbound edges, they can be serialized with "enc:ref" attributes to refer to the node by the identification defined in the "enc:id" attribute. Of course, the value of "enc:id" must be unique.

Example 5 - Multi references: The following graph represents two compound values sharing the same sub value.

   --- Bill -->( )--- mother --->               
                                ( )<-- Mary ---
   --- Mike -->( )--- sister --->               

Using the "enc:id" and "enc:ref" attributes, this graph can be easily serialized as:

   <Mary enc:id="101"/>
   <Bill>
    <mother enc:ref="#101"/>
   </Bill> 
   <Mike>
    <sister enc:ref="#101"/>
   </Mike> 

Example 6 - Circular References: The following graph represents two compound values has each other as their sub values.

                 <--- son ------
   --- Bill -->( )             ( )<-- Mary ---
                 --- mother --->               

Using the "enc:id" and "enc:ref" attributes, this graph can also be easily serialized as:

   <Mary enc:id="101">
    <son enc:ref="#102"/>
   </Mary> 
   <Bill enc:id="102">
    <mother enc:ref="#101"/>
   </Bill> 

Last update: 2007.

Sections in This Chapter

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

Dr. Herong Yang, updated in 2009
Multiple References and Circular References