3 Algorithm Examples
The following example shows the WBXML encoding of a server response that contains a new contact and provides a byte-by-byte description of the encoding.
The following XML represents a server response to a request to create a new contact.
-
<?xml version="1.0" encoding="utf-8"?> <Sync xmlns="AirSync" xmlns:airsyncbase="AirSyncBase" xmlns:contacts="Contacts"> <Collections> <Collection> <Class>Contacts</Class> <SyncKey>2</SyncKey> <CollectionId>2</CollectionId> <Status>1</Status> <Commands> <Add> <ServerId>2:1</ServerId> <ApplicationData> <airsyncbase:Body> <airsyncbase:Type>1</airsyncbase:Type> <airsyncbase:EstimatedDataSize>0</airsyncbase:EstimatedDataSize> <airsyncbase:Truncated>1</airsyncbase:Truncated> </airsyncbase:Body> <contacts:FileAs>Funk, Don</contacts:FileAs> <contacts:FirstName>Don</contacts:FirstName> <contacts:LastName>Funk</contacts:LastName> <airsyncbase:NativeBodyType>1</airsyncbase:NativeBodyType> </ApplicationData> </Add> </Commands> </Collection> </Collections> </Sync>
The Exchange ActiveSync: WAP Binary XML (WBXML) Algorithm encodes this XML as the following WBXML encoding.
-
03 01 6A 00 45 5C 4F 50 03 43 6F 6E 74 61 63 74 73 00 01 4B 03 32 00 01 52 03 32 00 01 4E 03 31 00 01 56 47 4D 03 32 3A 31 00 01 5D 00 11 4A 46 03 31 00 01 4C 03 30 00 01 4D 03 31 00 01 01 00 01 5E 03 46 75 6E 6B 2C 20 44 6F 6E 00 01 5F 03 44 6F 6E 00 01 69 03 46 75 6E 6B 00 01 00 11 56 03 31 00 01 01 01 01 01 01 01
The following table explains each byte in the WBXML encoding.
Bytes |
Description |
---|---|
03 |
Version number – WBXML version 1.3 |
01 |
Unknown public identifier |
6A |
Charset = UTF-8 |
00 |
String table length |
45 |
<airsync:Sync>, with content (0x05 + 0x40) |
5C |
<airsync:Collections>, with content |
4F |
<airsync:Collection>, with content |
50 |
<airsync:Class>, with content |
03 |
Inline string follows |
43 6F 6E 74 61 63 74 73 00 |
"contacts" (the 00 is the end of the string) |
01 |
</airsync:Class> |
4B |
<airsync:SyncKey>, with content |
03 |
Inline string follows |
32 00 |
"2" |
01 |
</airsync:SyncKey> |
52 |
<airsync:CollectionID>, with content |
03 |
Inline string follows |
32 00 |
"2" |
01 |
</airsync:CollectionID> |
4E |
<airsync:Status>, with content |
03 |
Inline string follows |
31 00 |
"1" |
01 |
</airsync:Status> |
56 |
<airsync:Commands>, with content |
47 |
<airsync:Add>, with content |
4D |
<airsync:ServerId>, with content |
03 |
Inline string follows |
32 3A 31 00 |
"2:1" |
01 |
</airsync:ServerId> |
5D |
<airsync:ApplicationData>, with content |
00 11 |
Select WBXML code page 17 (AirSyncBase) |
4A |
<airsyncbase:Body>, with content |
46 |
<airsyncbase:Type>, with content |
03 |
Inline string follows |
31 00 |
"1" |
01 |
</airsyncbase:Type> |
4C |
<airsyncbase:EstimatedDataSize>, with content |
03 |
Inline string follows |
30 00 |
"0" |
01 |
</airsyncbase:EstimatedDataSize> |
4D |
<airsyncbase:Truncated>, with content |
03 |
Inline string follows |
31 00 |
"1" |
01 |
</airsyncbase:Truncated> |
01 |
</airsyncbase:Body> |
00 01 |
Select WBXML code page 1 (Contacts) |
5E |
<contacts:FileAs>, with content |
03 |
Inline string follows |
46 75 6E 6B 2C 20 44 6F 6E 00 |
"Funk, Don" |
01 |
</contacts:FileAs> |
5F |
<contacts:FirstName>, with content |
03 |
Inline string follows |
44 6F 6E 00 |
"Don" |
01 |
</contacts:FirstName> |
69 |
<contacts:LastName>, with content |
03 |
Inline string follows |
46 75 6E 6B 00 |
"Funk" |
01 |
</contacts:LastName> |
00 11 |
Select WBXML code page 17 (AirSyncBase) |
56 |
<airsyncbase:NativeBodyType>, with content |
03 |
Inline string follows |
31 00 |
"1" |
01 |
</airsyncbase:NativeBodyType> |
01 |
</airsync:ApplicationData> |
01 |
</airsync:Add> |
01 |
</airsync:Commands> |
01 |
</airsync:Collection> |
01 |
</airsync:Collections> |
01 |
</airsync:Sync> |