There are two types of Web Services:
1. SOAP Web Services
2. RESTful Web Services
SOAP Web Services is the older of the two. Both of them are in use and both are equally popular.
In Java there are two different specifications for Web Services:
1. For SOAP Web Services the specification is called JAX-WS
2. For REST Web Services the specification is called JAX-RS
A Web Service is a service that is made available over the web i.e. a service that is available over the network and that is accessible over the network.
The difference between a website and a web service is that a website is meant for human consumption, whereas a web service is meant for code consumption or an application level consumption.
A Web Service allows two different machines, two different pieces of code, two different application servers running different pieces of code to talk to one another.
If you want a piece of code deployed on App Server 1 be called by another piece of code deployed on App Server 2, you can configure the piece of code on App Server 1 as a Web Service. Piece of code on App Server 2 can call the Web Service on App Server 1 directly at execution time.
You can write Web Service in .NET, Java, Python, C++ among other programming languages.
The best part of the Web Service standard is interoperability. A .NET piece of code can call a Java Web Service, and a Java piece of code can call a .NET Web Service.