What is a “web service” in plain English?

前端 未结 21 1096
半阙折子戏
半阙折子戏 2020-11-30 16:34

I\'ve been reading about \"web services\" here on SO, on Wikipedia, Google, etc., and I don\'t quite understand what they are. What is the plain English definition/descript

21条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 17:07

    For most sites you have HTML pages that you visit when you use your browser. These are human-readable pages (once rendered in your browser) where a lot of data might be crammed together, because it makes sense for humans.

    Now imagine that someone else want to use some of that data. They could download your page and start filtering out all the "noise" to get the data they wanted, but most websites are not built in a way where data is 100% certain to be placed in the same spot for all elements, so in addition to being cumbersome it also becomes unreliable.

    Enter web services.

    A web service is something that a website chooses to offer to those who wish to read, update and/or delete data from your website. You might call it a "backdoor" to your data. Instead of presenting the data as part of a webpage it is provided in a pre-determined way where some of the more popular are XML and JSON. There are several ways to communicate with a webservice, some use SOAP, others have REST'ful web services, etc.

    What is common for all web services is that they are the machine-readable equivelant to the webpages the site otherwise offers. This means that others who wish to use the data can send a request to get certain data back that is easy to parse and use. Some sites may require you to provide a username/password in the request, for sensitive data, while other sites allow anyone to extract whatever data they might need.

提交回复
热议问题