3 Structure Examples
The following example is of a SOAP document that uses the .NET Binary Format: SOAP Extension format.
Note that the document is the same document that is encoded in [MC-NBFS] section 3.
-
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:Header> <a:Action s:mustUnderstand="1">action</a:Action> </s:Header> <s:Body> <Inventory>0</Inventory> </s:Body> </s:Envelope>
Because the content "action" in the <Action> element is not present in the string structure as specified in [MC-NBFS] section 2, the string was written out fully.
Bytes (hex) |
Records |
Characters represented |
---|---|---|
99 06 61 63 74 69 6F 6E |
Chars8TextWithEndElement |
action</a:Action> |
Similarly, because the Inventory string was also not present, the <Inventory> element was written out verbosely.
Bytes (hex) |
Records |
Characters represented |
---|---|---|
40 09 49 6E 76 65 6E 74 6F 72 79 |
ShortElement |
<Inventory> |
If this document, or a similar document, is processed repeatedly, then it is advantageous not to have to repeat these bytes.
Using the .NET Binary Format: SOAP Extension, a StringTable (section 2.1) is used first to describe the two strings.
action
Inventory
According to the StringTable structure, these strings are encoded as shown in the following table. The Bytes column contains the bytes of the structure shown in hex, while the Chars column contains the same bytes shown as characters.
Bytes (hex) |
Chars |
---|---|
11 06 61 63 74 69 6F 6E 09 49 6E 76 65 6E 74 6F 72 79 |
..action.Inventory |
The bolded items in the preceding table are the size (0x11) of the overall structure encoded using MultiByteInt31 and the start of the two strings (0x06, 0x09) encoded using MultiByteInt31 as well. The string "action" is assigned a value of 1 and Inventory is assigned a value of 3, as specified in section 2.
Now, the two preceding records can be encoded more compactly, as shown in the following tables.
Bytes (hex) |
Records |
Characters represented |
---|---|---|
AB 01 |
DictionaryTextWithEndElement |
action</a:Action> |
Bytes (hex) |
Records |
Characters represented |
---|---|---|
42 03 |
ShortDictionaryElement |
<Inventory> |
The references to the string from the StringTable are in bold.