Binary Encoding Exercise Answers

I've gone ahead and put the message in the exercise in a small test program to demonstrate how the server would handle it. To help you out I've reformatted the input to make the record boundaries clear although the server obviously wouldn't take notice of any formatting. The dictionary of strings would ordinarily be supplied by WCF when you're using the message encoder.

 byte[] data = new byte[]
{
    0x56, 0x02,
    0x0B, 0x01, 0x73, 0x06,
    0x0B, 0x01, 0x61, 0x04,
    0x56, 0x08,
    0x44, 0x0A,
    0x1E, 0x00,
    0x98, 0x01, 0x31,
    0x98, 0x01, 0x61,
    0x01,
    0x01,
    0x56, 0x0E,
    0x98, 0x07, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 
    0x01,
    0x01
};
XmlDictionary strings = new XmlDictionary();
strings.Add("mustUnderstand");
strings.Add("Envelope");
strings.Add("www.w3.org/2005/08/addressing");
strings.Add("www.w3.org/2003/05/soap-envelope");
strings.Add("Header");
strings.Add("Action");
strings.Add("To");
strings.Add("Body");
XmlDictionaryReader reader =
    XmlDictionaryReader.CreateBinaryReader(data, 0, data.Length, strings, XmlDictionaryReaderQuotas.Max);
reader.Read();
Console.WriteLine(reader.ReadOuterXml());

Now, let's go over a translation of each of those records.

 0x56, 0x02 // <s:Envelope
0x0B, 0x01, 0x73, 0x06 // xmlns:s="www.w3.org/2003/05/soap-envelope"
0x0B, 0x01, 0x61, 0x04 // xmlns:a="www.w3.org/2005/08/addressing"
0x56, 0x08 // ><s:Header
0x44, 0x0A // ><a:Action
0x1E, 0x00 // s:mustUnderstand=
0x98, 0x01, 0x31 // "1"
0x98, 0x01, 0x61 // >"a"
0x01 // </a:Action>
0x01 // </s:Header>
0x56, 0x0E // <s:Body>
0x98, 0x07, 0x4D, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65 // "Message"
0x01 // </s:Body>
0x01 // </s:Envelope>