What is a "web service" in plain English?
Asked Answered
C

21

189

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/description?

If I make a simple website using PHP that just, say, prints a random integer to the page... is this a "web service"? If not, why not?

Cleruchy answered 22/10, 2008 at 14:56 Comment(0)
R
291

A simple definition: A web service is a function that can be accessed by other programs over the web (HTTP).

For example, when you create a website in PHP that outputs HTML, its target is the browser and by extension the human reading the page in the browser. A web service is not targeted at humans but rather at other programs.

So your PHP site that generates a random integer could be a web service if it outputs the integer in a format that may be consumed by another program. It might be in an XML format or another format, as long as other programs can understand the output.

The full definition is obviously more complex but you asked for plain English.

Religiose answered 22/10, 2008 at 15:3 Comment(5)
This explanation is good, but what breaks ability to consume the random integer by other program from HTML? There are plenty of libraries to read HTML and this is the same as reading XML for me, and almost same as reading JSON. I know this post very old, though comment please, if it possible.Davilman
Its a matter of intention rather than capability. The intention of the web service is to be consumed by other applications. The intention of html is to be rendered for the user by the browser.Religiose
for anyone else who feels like this sounds very similar to an API - see this great article for the differences between a web service and an apiDiedra
All WebServices are APIs that involve communication over the web... So, one should not think that web services and APIs are mutually exclusive termsWatchband
Obviously nobody ever encountered XHTML, which can be parsed even better by machines than HTML because it's 100% XML - yet there needs to be a distinction between site and service? I just don't get it, especially since web services tend to provide fewer details than the website would, yet most think it's difficult to read... Websites aren't for humans either: the bloated web browser first needs to render the HTML into something useful for them - that's a program, too...Narayan
D
63

Simplified, non-technical explanation: A web serivce allows a PROGRAM to talk to a web page, instead of using your browser to open a web page.

Example: I can go to maps.google.com, and type in my home address, and see a map of where I live in my browser.

But what if you were writing a computer program where you wanted to take an address and show a pretty map, just like Google maps?

Well, you could write a whole new mapping program from scratch, OR you could call a web service that Google maps provides, send it the address, and it will return a graphical map of the location, which you can display in your program.

There is a lot more to it, as some of the other posts go into, but the upshot is that it allows your application to either retrieve information FROM, or submit information TO some resource. Some other examples:

  1. You can use a web service to retrieve information about books at Amazon.com
  2. You can use a similar web service to submit an order to Amazon.com
  3. You could CREATE a web service to allow outside applications to find out about product information within your company
  4. you could create a web service to allow outside applications to submit orders to your company.
Doronicum answered 22/10, 2008 at 15:3 Comment(0)
S
34

Yes that is a simple web service.

Web services are really nothing more than a request/ response mechanism that allows a client to remotely access/ modify data. There are formal standards for web services (SOAP, SOA etc), but your simple page is a service too.

The main downside to printing it to a page is that your service would return HTML. Preferable data formats are JSON and XML, because most client frameworks (and server frameworks) are designed around using JSON and XML.

So if you modified your service to return:

<RANDOM>some random number</RANDOM>

rather than:

<HEAD>...</HEAD>  
<BODY>some random number</BODY>

then it would be more useful to most clients

Schultz answered 22/10, 2008 at 15:0 Comment(2)
Have updated my answer to reflect that. Had problems with SO not displaying XML/ HTML tabs :)Schultz
Thanks. Exactly what I think about that. XML is very similar to HTML, so HTML page we talking about provided by web service.Davilman
S
21

In over simplified terms a web service is something that provides data as a service over the http protocol. Granted that isn't alway the case....but it is close.

Standard Web Services use The SOAP protocol which defines the communication and structure of messages, and XML is the data format.

Web services are designed to allow applications built using different technologies to communicate with each other without issues.

Examples of web services are things like Weather.com providing weather information for that you can use on your site, or UPS providing a method to request shipping quotes or tracking of packages.

Edit

Changed wording in reference to SOAP, as it is not always SOAP as I mentioned, but wanted to make it more clear. The key is providing data as a service, not a UI element.

Steffen answered 22/10, 2008 at 15:0 Comment(1)
It doesn't have to be SOAP - if you're talking about web services (in lowercase) then REST is increasingly common.Trawick
B
17

A web service differs from a web site in that a web service provides information consumable by software rather than humans. As a result, we are usually talking about exposed JSON, XML, or SOAP services.

Web services are a key component in "mashups". Mashups are when information from many websites is automatically aggregated into a new and useful service. For example, there are sites that aggregate Google Maps with information about police reports to give you a graphical representation of crime in your area. Another type of mashup would be to take real stock data provided by another site and combine it with a fake trading application to create a stock-market "game".

Web services are also used to provide news (see RSS), latest items added to a site, information on new products, podcasts, and other great features that make the modern web turn.

Hope this helps!

Basinger answered 22/10, 2008 at 15:2 Comment(0)
M
15

The best plain English explanation comes from using an analogy:

  • Web pages allow people to communicate and collaborate with each other.
  • Web services allow programs to communicate and collaborate with each other.

Your PHP example is a web service by that definition, because the output could be consumed by another program. But in reality, HTML screen-scraping is not a reliable or maintainable way of producing web services.

Maddi answered 24/10, 2008 at 10:19 Comment(0)
R
13

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.

Regality answered 22/10, 2008 at 15:16 Comment(0)
P
12

A web service is a collection of open protocols and standards used for exchanging data between applications or systems. Software applications written in various programming languages and running on various platforms can use web services to exchange data over computer networks like the Internet in a manner similar to inter-process communication on a single computer. This interoperability (e.g., between Java and Python, or Windows and Linux applications) is due to the use of open standards (XML, SOAP, HTTP).

All the standard Web Services works using following components:

  • SOAP (Simple Object Access Protocol)
  • UDDI (Universal Description, Discovery and Integration)
  • WSDL (Web Services Description Language)

It works somewhat like this:

  • The client program bundles the account registration information into a SOAP message.
  • This SOAP message is sent to the Web Service as the body of an HTTP POST request.
  • The Web Service unpacks the SOAP request and converts it into a command that the application can understand.
  • The application processes the information as required and responds with a new unique account number for that customer.
  • Next, the Web Service packages up the response into another SOAP message, which it sends back to the client program in response to its HTTP request.
  • The client program unpacks the SOAP message to obtain the results of the account registration process.
Piercy answered 18/1, 2015 at 18:52 Comment(2)
"All the standard Web Services works using following components:" ... the problem with this answer is that it suggests that web services do or must operate within the SOAP/WSDL mechanism. This is inaccurate. Representational State Transfer (REST) is another very popular paradigm for implementing web services. Some major websites have deprecated their SOAP services in favor of REST web services.Unaneled
@Unaneled I Totally agree. Thanks for the update. Also, in my defence, my knowledge regarding Web services was very limited back then!Piercy
S
7

Simple way to explain web service is ::

  • A web service is a method of communication between two electronic devices over the World Wide Web.
  • It can be called a process that a programmer uses to communicate with the server
  • To invoke this process programmer can use SOAP etc
  • Web services are built on top of open standards such as TCP/IP, HTTP

The advantage of a webservice is, say you develop one piece of code in .net and you wish to use JAVA to consume this code. You can interact directly with the abstracted layer and are unaware of what technology was used to develop the code.


Image

Sneeze answered 10/7, 2013 at 4:38 Comment(0)
B
7

Webservice is a technology by which two or more remote web applications interact with each other over network/internet. It can be implemented using Java, .net, PHP etc.

Features of Web service:-

  1. Using web services two or more systems exchange data over network. Data are exchanged either using XML or JSON.
  2. Any web service has two parts Server end where the service is deployed and the client part where the service is accessed by its clients. Any web service can have multiple clients. When a travel portal is selling tickets of an airliner. Portal is client and the Airline is the server as it is selling its service.
  3. Web services can be synchronous or it can be asynchronous also.A web application can interact with many web services but these web services are loosely coupled with their client web applications. That means any change in the parent application has little or no effect on the web services or vice versa.
  4. Web services can carry attachment document also like PDF, Word etc. with its XML payload. Java provides separate API for this type of web services.
  5. A web service always hides the internal complexity of the service to its clients. For an example, an airliner which is selling tickets via a third party portal is only gathering end user info via a web service and in return it is providing ticket. The portal which is selling ticket doesn't have to bother about the internal complexity of the airlines ticket reservation systems.
  6. A web service can be of fire and forget type or it can return something. Suppose, a web application just want to send some info to a third party application. The sender doesn't need any acknowledgement from the receiver. In this type of scenario we need a fire and forget type of web service.
Bicolor answered 27/8, 2015 at 6:9 Comment(0)
S
5

A web service, as used by software developers, generally refers to an operation that is performed on a remote server and invoked using the XML/SOAP specification. As with all definitions, there are nuances to it, but that's the most common use of the term.

Sabadell answered 22/10, 2008 at 15:1 Comment(1)
Sorry Jezelll, had to throw a downvote. This is not what I would consider 'plain english' :( I don't have a problem with the intent of your definition, but using words like 'operation', 'remote server', 'invoked' and 'specification' makes it hard for beginners to understand. See Mitchel Sellers answer as an example of 'plain english'.Tull
T
5

An operating system provides a GUI (and CLI) that you can interact with. It also provides an API that you can interact with programmatically.

Similarly, a website provides HTML pages that you can interact with and may also provide an API that offers the same information and operations programmatically. Or those services may only be available via an API with no associated user interface.

Trawick answered 22/10, 2008 at 15:4 Comment(0)
C
4

Well,

As @Vincent Ramdhanie has said that a web service is not meant to be seen / consumed by end user but another program. So technically logic in your program will be:

In case of acting as a normal program

user on website -> HTML/JS/JQuery etc -> give me a random number ->ur program

Now

ur program -> generate random number -> generate HTML and encapsulate o/p -> go back to user

but in case of web service the flow changes a little:

user -> my application -> XML/JSON/some other format -> give me a random number ->ur program Now

ur program -> generate random number -> generate XML/JSON/some other format -> my application -> generate HTML and encapsulate o/p -> go back to user

Hope this helps :)

Contrabandist answered 9/1, 2016 at 20:8 Comment(0)
T
3

A simple definition would be an HTTP request that acts like a normal method call; i.e., it accepts parameters and returns a structured result, usually XML, that can be deserialized into an object(s).

Tushy answered 22/10, 2008 at 15:0 Comment(0)
J
3

Web services are almost like normal a web page. The difference is that they are formatted to make it very easy for a program to pull data from the page, to the point of probably not using any HTML. They generally also are more reliable as to the consistency of the format, may use a different formal process to define the content such soap or raw xml, and there is often also a descriptor document that formally defines the structure for the data.

Jessi answered 22/10, 2008 at 15:4 Comment(0)
S
3

A way of sending a message to invoke an operation on another computer. The difference between web services and previous methods is what gets sent over the wire is standardized at a higher level.

Old way: describe endians, encoding, port numbers, etc. Web Service: URL, XML

Synthesis answered 5/8, 2010 at 2:53 Comment(0)
M
3

Web Service is like a medium of commuication between two unrelated programs. The programs use a specified protocol(Usually Simple Object Access Protocol (SOAP)) as medium to understand what REQUEST/RESPONCE they are to process/execute on there respective end.

Messier answered 7/7, 2015 at 15:39 Comment(0)
P
2

A web service defines a contract of actions that a server will perform for you. The format and protocol doesn't really matter, but you should have some set definition of how the communication happens.

In your example, it depends, if that is being used in another application that reads that number, yes it is service, otherwise, it's just a webpage with a number.

Pasty answered 22/10, 2008 at 15:2 Comment(0)
K
1

In simple words Web service could be any simple program ex: add two numbers which should be published over the UDDI and can be consumed by another program.WSDL will have the endpoint to locate the webservice and also the binding and port details.

Kandis answered 7/6, 2016 at 10:23 Comment(0)
H
0

'Web Service' is composed of two words,'Web' and 'Service'.
What is 'Web'? 'Web' means 'World Wide Web'.
'Service' for what? Not for Human,if so,it's 'Web Page',such as text,images,video etc.
It's for Programs to communicate through the Internet using the same technology the 'Web' used,such as TCP,HTTP etc.
'Service' also means it provides some functions,like the 'Service Layer' in CRUD. There are mainly two types:
1. SOAP(Simple Object Access Protocol)
2. RESTful(Representational state transfer)

Hokku answered 22/2, 2018 at 7:25 Comment(0)
P
0

Without prejudice to other definitions I would say that a web service is software system that allows for inter-operable machine-to-machine / application-to-application interaction over a network. This generic definitions would also help consider REST architectures to be a web service as they provide similar functionality albeit being an architectural style unlike the SOAP which is a fully defined protocol.

Perfidy answered 6/6, 2019 at 21:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.