Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the different between http request and web service

Tags:

web-services

I have googled about "web service" and I also read it in wiki:

A Web service is a method of communications between two electronic devices over the World Wide Web

However I can not make it clear about what is the web service mean.

How about the common http request which return xml or json rather than a html content? For example:

http://www.server.com/ws/getitem?id=xxxx

This is a interface used to get item detail by id, while return data of json or xml format.

Now if we implement it by so said web service manner, what will be done?

like image 429
hguser Avatar asked Feb 22 '14 05:02

hguser


1 Answers

A normal web page returns HTML, PDF, or image data that's intended to be displayed to the user in a browser.

A web service returns data that's intended to be used by another program, rather than displayed directly to the user; another common term for this is API, i.e. Application Programming Interface. Rather than returning HTML, it returns data that's structured to be easy for computers to extract the values. Common formats are XML and JSON. The web service might also use a structured format for requests, such as SOAP or WSDL, but some (like your example) just use URL query parameters.

Both web services and normal web pages use HTTP as the data transfer protocol. The difference is in how they're used by clients.

like image 132
Barmar Avatar answered Oct 17 '22 18:10

Barmar