I was working on a project the other day pushing around untyped messages. When I say untyped the orchestration ports are using the type System.Xml.XmlDocuemnt. I wrote a custom pipeline component to dynamically pre-pend processing instructions to the outbound xml based on mesage type. When I went to lookup the messageType context property I found it wasn’t set, which makes sense.
After a bit of looking around I found others had solutions that didn’t really suit my needs. e.g. one solution was to expose properties on the pipeline component and set the properties at design time, and another was to load the entire document into memory using System.Xml.XmlDocument. Neither approach sat well with me so I ended up taking a streaming approach using XmlTextReader to stream through the IBaseMessage.BodyPart.GetOriginalDataStream.