Is there a difference between a web server and a web service?
To me, these terms sound very similar. Is there a difference really?
A web service will be running on a web server.
A web server is a piece of software designed to serve web pages/web sites/web services. Examples are IIS, Apache and many more. The name can also refer to the hardware running this software.
As web service will be running inside a web server - normally serving up XML or performing some action in response to input.
From wikipedia:
Web services today are frequently just Application Programming Interfaces (API) or web APIs that can be accessed over a network
A web service is an application that is run by a web server and that results in a series of URLs that will return their data in a format that is intended to be parsed by a 'generic' computer program instead of by a browser. As a result web services can use any data format they want (as long as both sides agree), but typically something like XML (specifically SOAP or so) or JSON is used.
The differences between a "web server" and a "web service" are as follows:
Web Server:
- is a piece of software that run on a physical or virtual machine, which designed to serve web pages/web sites/web services.
- transport channel used by web server necessarily need to be HTTP protocol.
- accept HTTP requests and respond by giving HTTP responses.
Web Services:
is an application run by a web server, performing tasks and returning structured data to a calling program, rather than HTML for a browser.
due to that reason, it can use any data format they wish—perhaps something like XML, SOAP, or JSON.
- transport channel used by web services doesn't necessarily need to be the HTTP protocol.
- mainly there are two types of web services (in Microsoft land): WCF and ASMX. WCF services are "hosted" by IIS, whereas ASMX web services run within IIS.
Many of these answers are wrong.
While a Web Server is necessarily an HTTP server, a Web Service is simply a service that is available through the network. As the protocol may not be HTTP, you may provide WebServices over mail or other protocols, and you do not need a web server for that.
The transport channel used by Web Services doesn't necessarily need to be the HTTP protocol.
The term "Web Services" is also used to refer to the SOAP xml standard, that is a standard way to encode the information in Web Service invocations.
Definition of Web Server
Definition of WebService
A Web Server generally refers to software running on a physical or virtual machine that processes web requests (e.g. returning pages to browsers and executing calls to Web Services)
A Web Service runs in a Web Server performing tasks and (generally) returning structured data to a calling program, rather than html for a browser.
In a nutshell:
A Web Service is an application that can be accessed over a network, such as the internet. A Web Server is a program that delivers content over HTTP.
So, if you want your Web service to be accessed over the internet, you'll set it up on a Web Server.
Should we need to go too technical?
I hope to be useful to you saying you that :
A "web server" is a server application (like Microsoft IIS or Apache) which is used to compile and run websites, or "web application". A "web server" can host some "web services" too.
A "web service" is a component installed over a "web server". These components could be called by a website or a "web application" using HTTP requests.
If you want more information about that consult MSDN, searching the "web service" string
Bye
Maybe from an underlying technology perspective there is not much difference (request-response going over a channel), but the purpose diversifies the meaning:
- Web server usually refers to delivering web page content for a user.
- Web service refers to an API invocable over standard web protocols.
Of course nowadays with the coming of Web 3.5 the borders between phrases becomes fuzzy ;)
To add to the given answers, it would make more sense to ask "What is the difference between a web service and a (by-server-created) web page".
Technically there is none. They both output something XML-ish after a request.
Server is a "machine" to dispatch user HTTP request and host web project, including also web services.
Web Service is a specific kind of web server, which (usually) provides a set of methods which arbitrary clients can call: something like a remote API mechanism.
Web server is just a generic term and would include not just web services, but http servers etc.
From wikipedia:
A web server is a computer program that delivers (serves) content, such as web pages, using the Hypertext Transfer Protocol.
Web services today are frequently just Application Programming Interfaces (API) or web APIs that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services.
Though both are some sort of a computer program but with different purpose. Web Server's have a specific purpose of delivering web content whereas Web Services have a broader role to play.
Because no-one else has mentioned it yet, there are two types of webservice (in Microsoft land): WCF and asmx. WCF services are "hosted" by IIS, asmx webservices run within IIS. WCF services can also be hosted by a separate self contained service (and you can still use HTTP to connect to it).
Webservices is a huge subject, you really should start somewhere like here.
There is no exact differentiation as such, but in the context of usage of these terms, this is what they would mean:
- The term Web servers is used for a piece of software that is written for communication to/from browsers and ends up serving human readable content via a browser (HTML/JS/Images/Video).
- Web services on the other hand are intended for communication between computers (humans do not consume the end result, instead computers do), for example native mobile/desktop apps, Single Sign Ons. They usually output JSON or an XML documents.
Simplifying it further from a developer's perspective. If you are generating HTML as a response, it is a web server. If your response is a JSON or an XML file its a web service.
To my knowledge, a "web service" is a programmed component, that provides a certain functionality, while a "web server" is either a machine that runs software to provide for web service's needs, or the software itself.
Web Server is a program which accepts HTTP requests and respond by giving HTTP responses.
Web services is a software system developed to help machine to machine interaction or from one web application to another web application over the network.
精彩评论