tags:

views:

527

answers:

1

Is the WebGetAttribute just syntactic sugar for the WebInvokeAttribute with Method = "GET"? Or is there an underlying difference?

+2  A: 

Your immediate observation that WebGet and WebInvoke are very similar is not all too far from the truth. WebGet, as you've already stated, applies to the HTTP GET verb while WebInvoke can be used to apply to all the other verbs (PUT, POST, DELETE, etc).

Many of the parameters in WebInvoke mirror those in WebGet. BodyStyle, RequestFormat, ResponseFormat, and UriTemplate are all present for both WebGet and WebInvoke. The one differentiator is the presence of the "Method" parameter for WebInvoke. The Method parameter specifies the HTTP verb that corresponds to the operation, with POST being the default value.

I haven't had the chance to use Reflector to look under the hood for WebGet and WebInvoke but I suspect that they are very much alike even though they only seem to share System.Attribute as a common lineage.

Thomas Beck