WCF Rest service how to set the response message style RRS feed

  • Question

  • Hi all,

    I want to know how to set the response message style with WCF Rest Service.

    Best Regards,

    Vince Li

    Monday, August 31, 2015 11:26 AM


  • Hi Vince,

    According to this case, as far as I know in WCF we can set Bare and wrapped for xml and json.

    For example:

    public interface IEmployees
        [WebInvoke(UriTemplate = "/", Method = "POST", 
        RequestFormat = WebMessageFormat.Xml, 
        ResponseFormat = WebMessageFormat.Xml, 
        BodyStyle = WebMessageBodyStyle.Wrapped)]
        Employee Create(Employee employee);

    We can set ruquestFormat and responseFormat as xml and json. And BodyStyle can be Bare and Wrapped.

    I hope that will be helpful to you.

    Best Regards,


    • Marked as answer by Jimyken Tuesday, September 1, 2015 1:04 AM
    Monday, August 31, 2015 2:30 PM