public void XmlInputIs(object target) { var writer = new StringWriter(); var serializer = new XmlSerializer(target.GetType()); serializer.Serialize(writer, target); var xml = writer.ToString(); var bytes = Encoding.UTF8.GetBytes(xml); var stream = _parent.Request.Body; stream.Write(bytes, 0, bytes.Length); stream.Position = 0; _parent.Request.ContentType = MimeType.Xml.Value; _parent.Accepts(MimeType.Xml.Value); _parent.Request.ContentLength = xml.Length; }