Theme-Logo
  •   .Net
    •   C Sharp(C#)
    •   Web API
    •   Micro Services
    •   ASP.Net
    • ASP.Net MVC
    • .Net Core
  •   Database
    • SQL Server
    • Oracle
    • PostgreSQL
  •   jQuery
    • jQuery Tutorials
    • jQuery Plugins
    • jQuery UI
    • More on jquery
  •   Tutorials
    • Microservices Tutorials
    • DotNet Core Tutorials
    • PostgreSql Tutorials

Web API vs Web Service C#

In programming world, OPPS become so popular due to its reusibility and other important features what we had discussed in OOPS Concept. So, if we need to create any method in a class which can be accessible inside another classes as well so it must be public . And if we need to make any method of a class accessible for whole world (of course by different plateform and different application) then we must keep it over internet and this is called Web Service.

So, Web Services is a application/program which are available/accessible over internet.

Web Services in C#

A Web services are any bit of services/HTTP Service) that makes it accessible over the Internet and normalizes its correspondence through XML encoding. Web services are equivalent to SOA (Services Oriented Architecture) and fundamentally depend on measures, for example, XML-RPC and SOAP (Simple Object Access Protocol).

Components Of Web Services

A standard web services work using the following components.

  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)
  • We'll discuss in details about Web Service in another article.

    Web API in C#

    An API is some kind of interface/application which has a set of functions that allow programmers to access specific features or data of an application, operating system or other services.

    Web API as the name suggests, is an API over the web which can be accessed using HTTP protocol. Please keep in mind that Web API is a concept and not a technology

    It is used to create RESTful web services. REST stands for Representational State Transfer, which is an architectural style for networked hypermedia applications. It is primarily used to build Web Services that are lightweight, maintainable, and scalable, and support limited bandwidth.It is used to create a simple HTTP Web Service. It supports XML, JSON, and other data formats.

    Why Web API if Web Service was already there?

    For this question I have a simple answer- all web services are APIs, but not all APIs are web services.APIs and web services are not mutually exclusive. In fact, one is a subset of the other: every web service is an API — since it exposes an application’s data and/or functionality — but not every API is a web service.

    Web API vs Web Service in C#

    Both web services and APIs are — at their core — very useful and very much used today but there are some differences between them are:

  • Web service is a collection of open source protocols and standards used for exchanging data between systems or applications whereas API is a software interface that allows two applications to interact with each other without any user involvement.
  • Web service is used for REST, SOAP and XML-RPC for communication while API is used for any style of communication.
  • Web service supports only HTTP protocol whereas API supports HTTP/HTTPS protocol.
  • Web service supports XML while API supports XML and JSON.
  • You need a SOAP protocol to send or receive and data over the network for web service. Therefore it does not have light-weight architecture. Whereas API has a light-weight architecture.
  • All Web services are APIs but all APIs are not web services.
  • Summary

    To summarise, APIs are application interfaces, meaning that one application is able to interact with another application in a standardized way. Web services are a type of API, which must be accessed through a network connection. Hope you picked up a thing or two.

    Cheers!

    ❮ Previous
    Next ❯

    Trending Post
    Benefits of using ASP.NET Core over ASP.NET.
    Role of Startup class in .Net Core.
    Interview Questions and Answers
    What is Request delegate?
    What is Host in ASP.NET Core?
    Describe the Generic Host and Web Host?
    Describe the Servers in ASP.NET Core?
    How to read values from Appsettings.json file?
    How to handle errors in ASP.NET Core?
    About us

    DotNet Palace is a community platform created and maintained by The articles are mainly focused on Microsoft stack technologies like C#, ASP.Net, MVC, .Net Core, SQL Server and Oracle, PostgreSQL, SQLite etc. To improve the site's content you can send your valuable suggestions at info.dotnetpalace@gmail.com

    Quick links
  • SOLID Principles
  • Questions
  • OOPS Principles
  • DotNet Palace Tutorials
  • Privacy Policy
  • Terms and Condition