How Can I add Header to this Message and take all xml document?
private Message GetRootMessage()
{
var stream = new MemoryStream();
XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(stream);
writer.WriteStartDocument();
writer.WriteStartElement("Body");
writer.WriteAttributeString("abc", "2012-04-17t10:00:00Z");
writer.WriteAttributeString("abd", "CA");
writer.WriteAttributeString("bid", "35353");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Flush();
stream.Position = 0;
XmlDictionaryReader reader =
XmlDictionaryReader.CreateTextReader(
stream, XmlDictionaryReaderQuotas.Max);
return Message.CreateMessage(
MessageVersion.None, "", reader);
}
IDispatchMessageInspector is you friend here, have a look at this post for ideas.