WCFは、ServiceContractのWebGetアノテーションのResponseFormat属性に2つのオプションを提供します。
[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です。独自のWebメッセージ形式を作成することはできますか?クライアントがfoo()メソッドを呼び出すと、jsonまたはxmlラッパーなしで生の文字列を取得するようにしたいと思います。