This text file contains example code from: Chapter 19 - Service Performance Optimization Book - SOA with .NET & Windows Azure: Realizing Service-Orientation with the Microsoft Platform Series - Prentice Hall Service-Oriented Computing Series from Thomas Erl (www.soabooks.com/community) Certification - These examples are used as part of the Certified SOA .NET Developer curriculum (www.soaschool.com) <programlisting linenumbering="unnumbered">public Message <emphasis role="pd_red">Request</emphasis>(Message message, TimeSpan timeout) { Message msg = null; if (message.Headers.Action == "http://example.org/ IProductService/GetProductInformation") { MessageBuffer buffer = message.CreateBufferedCopy(2000); Message tempMsg = buffer.CreateMessage(); XmlDictionaryReader dictread = tempMsg.GetReaderAtBodyContents(); dictread.ReadToFollowing("productId", "http://example.org/"); string productId = dictread.ReadString(); if (cache.TryGetValue(productId, out msg)) { msg.Headers.RelatesTo = message.Headers.MessageId; } else { message = buffer.CreateMessage(); msg = innerChannel.Request(message, timeout); buffer = msg.CreateBufferedCopy(int.MaxValue); cache.Add(productId, buffer.CreateMessage()); msg = buffer.CreateMessage(); } } else { msg = innerChannel.Request(message, timeout); } return msg; }</programlisting> </example>