WCF предлагает два варианта атрибута ResponseFormat в аннотации WebGet в ServiceContract.
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "greet/{value}", BodyStyle = WebMessageBodyStyle.Bare)]
string GetData(string value);
[OperationContract]
[WebGet(UriTemplate = "foo", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
string Foo();
Параметры ResponseFormat - это WebMessageFormat.Json и WebMessageFormat.Xml. Возможно ли написать собственный формат веб-сообщений? Я хотел бы, чтобы когда клиент вызывал метод foo(), он получал необработанную строку - без json или xml-оберток.