You must Sign In to post a response.
  • Category: WCF

    What are the Advantages of using webapi over wcf and webservices

    i was asked in an interview the following question about webapi

    Why we need webapi?

    I told "the services that are created in webapi can be used across wide range of devices like laptop, desktop, tablet and mobiles."

    Then the interviewer asked why it cannot be done using web services and wcf?

    I don't know the answer.

    Can anyone let me know the answer.
  • #767742
    Hai Rajan,
    There are many reasons why WebApi is better than WCF or Web Services:
    1. WebApi is HTML based which the WCF or Web Services are service based.
    2. WebApi can be called directly by the WebHttp request which for WCF and Web Service, we need to consume it to the client application and then create the proxy to get the methods.
    3. WebApi is stateless means each time a new request will be created.
    4. WebApi is simple and easy to create/call etc which Web Service and WCF service are difficult.
    5. WebApi uses HTTP methods- GET, PUT, POST, DELETE which the WCF Service uses Contracts and Web Services uses Web methods.
    6. By default, WebApi supports JSON format data which is simple text format while WCF support SOAP+XML which needs to be converted to the client object format.
    7. WebAPi is faster than WCF and Web Services.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #767768
    WebAPI is more convenient way for HTTP only. First-class programming model for HTTP. More suitable for access from various browsers, mobile devices etc enabling wide reach. it notonly Enables building Web APIs that support wide variety of media types including XML, JSON etc. but There is a variety of ways to describe a Web API ranging from auto-generated HTML help page describing snippets to structured metadata for OData integrated APIs.
    It Ships with .NET framework but is open-source and is also available out-of-band as independent download.
    ASP.NET Web API is more complete and all future REST feature improvements will be made in ASP.NET Web API

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #767792
    Hi,

    The simple and one word answer is Web API is RestFull service where as WCF & Webservices are not.

    First get the differences between those 3 then you come to know what is what.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments