WebInvokeAttribute.BodyStyle Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the body style of the messages that are sent to and from the service operation.
public:
property System::ServiceModel::Web::WebMessageBodyStyle BodyStyle { System::ServiceModel::Web::WebMessageBodyStyle get(); void set(System::ServiceModel::Web::WebMessageBodyStyle value); };
public System.ServiceModel.Web.WebMessageBodyStyle BodyStyle { get; set; }
member this.BodyStyle : System.ServiceModel.Web.WebMessageBodyStyle with get, set
Public Property BodyStyle As WebMessageBodyStyle
One of the WebMessageBodyStyle enumeration values.
The following example shows how to set the BodyStyle property.
[OperationContract]
[WebInvoke(UriTemplate = "Mult?x={x}&y={y}", BodyStyle = WebMessageBodyStyle.Bare)]
long Multiply(long x, long y);
<OperationContract()> _
<WebInvoke(UriTemplate:="Mult?x={x}&y={y}", BodyStyle:=WebMessageBodyStyle.Bare)> _
Function Multiply(ByVal x As Long, ByVal y As Long) As Long
When set to Bare, the result of the service operation is written directly to the body of the response message.
Note
Operations that take a Message and return void are handled specially by the formatters. The formatters do not emit the wrapper name in the response even if BodyStyle is set to Wrapped.
Product | Versions |
---|---|
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: