bool IsBodySpecial(Type body, string direction, out Message message)
{
message = null;
if (body == null || body == typeof(void))
{
message = CreateTextMessage(String.Format("The {0} body is empty.", direction));
}
else if (body == typeof(Stream))
{
message = CreateTextMessage(String.Format("The {0} body is a byte stream. See the service documentation for allowed content types.", direction));
}
else if (typeof(Atom10FeedFormatter).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is an Atom 1.0 syndication feed. See http://tools.ietf.org/html/rfc4287 for more details.", direction));
}
else if (typeof(Atom10ItemFormatter).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is an Atom 1.0 syndication entry. See http://tools.ietf.org/html/rfc4287 for more details.", direction));
}
else if (typeof(AtomPub10ServiceDocumentFormatter).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is an Atom Pub service document. See http://www.rfc-editor.org/rfc/rfc5023.txt for more details.", direction));
}
else if (typeof(AtomPub10CategoriesDocumentFormatter).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is an Atom Pub categories document. See http://www.rfc-editor.org/rfc/rfc5023.txt for more details.", direction));
}
else if (typeof(Rss20FeedFormatter).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is an RSS 2.0 syndication feed. See http://validator.w3.org/feed/docs/rss2.html for more details.", direction));
}
else if (typeof(NameValueCollection).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is a HTML Forms data.", direction));
}
else if (typeof(XElement).IsAssignableFrom(body) || typeof(XmlElement).IsAssignableFrom(body))
{
message = CreateTextMessage(String.Format("The {0} body is arbitrary XML. See the service documentation for conformant XML documents.", direction));
}
return (message != null);
}