none
WebGet VS WebInvoke RRS feed

  • Question

  • Hi,

    When use the wcf rest service, we can use the WebGet or WebInvoke. But when to use WebGet, when to use WebInvoke?

    Wednesday, September 18, 2013 6:16 AM

Answers

  • Hi Professo,

    >>When use the wcf rest service, we can use the WebGet or WebInvoke.

    The both indicating that a service operation can be called by the WCF REST programming model, WebGet indicates a retrieval operation, WebInvoke indicates an invoke operation, you can find some samples using WebGet or WebInvoke in the msdn document.

    >>But when to use WebGet, when to use WebInvoke?

    WebGet is similar to WebInvoke(Method="GET"), WebGet has same set of properties with WebInvoke except Method which is implicitly GET, the possible values of Method for WebInvoke are: GET, POST, PUT, DELETE. For details of the usage of these http verbs, you can check a post at: http://stackoverflow.com/questions/6136307/advantages-of-webinvoke-post-compared-to-webget

    So regarding to your question, WebGet commonly used to retrieve data, WebInvoke commonly used for data input/update, POST is the default value of WebInvoke and it can be changed by setting the Method property of the attribute.

    Best Regards.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, September 19, 2013 12:06 AM
    Moderator