Click here to Skip to main content
13,901,646 members
Rate this:
 
Please Sign up or sign in to vote.
We can implement web applications using class library to talk to database server, or to another application/APIs.

Then why we need web services??

What can be done in web services, which cannot be done in class library ??


What I have tried:

What can be done in web services, which can't be done in class library ??
Posted
Updated 3-Jan-19 22:04pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

APIs allow applications to interact with one another, and as a whole do not specify what communication medium or protocol is used.

A Web Service is basically a wrapper around an API which uses a computer network as the communication medium and generally uses the HTTP protocol.

All Web Services are APIs, but not all APIs are Web Services.
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Adding to the existing solution provided, here's my take:

Class libraries will turn into Dynamic-link library (a.k.a DLL). All consuming clients will have to add the dll to their project to reference them. This is fine if you will be dealing with applications within your premise or domain. However, if there are other client applications that want to reference your class library then it's gonna be a pain in the butt because you have to ensure that they got the right version and the proper access to your dll. With Web Services, you can simply host them in public facing server where other client applications can have access to via HTTP.

The important difference between them is that if you are working on modern web applications that heavily relies on AJAX and JavaScript and you want to communicate with your data from the server, then a class library can't do that. One advantage of the Web Services is to be able to communicate with your data via AJAX calls.
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190306.1 | Last Updated 4 Jan 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100