Friday 28 May 2010

Changing WCF OperationContract Element Names

Changing the root names of the request and response messages:

[OperationContract(Name=”RequestRootNameChanged”)]
      [WebInvoke(Method = "GET",
        UriTemplate = "/EntityData/{entity}",
        BodyStyle = WebMessageBodyStyle.Wrapped,
        ResponseFormat = WebMessageFormat.Json)]
      [return:MessageParameter(Name = "ResponseRootNameChanged")]
      List<ReferenceItem> GetSearchDropDown(string entity);

Removing the root names of the request and response messages:

[OperationContract]


      [WebInvoke(Method = "GET",


        UriTemplate = "/EntityData/{entity}",


        BodyStyle = WebMessageBodyStyle.Bare,


        ResponseFormat = WebMessageFormat.Json)]


      List<ReferenceItem> GetSearchDropDown(string entity);

Changing the child names:

No comments: