A web service is a collection of open protocols and standards by which two or more remote applications or systems interact with each other over network/internet.
They are really nothing more than a request/ response mechanism that allows a client to remotely access/ modify data.
Standard Web Services use The SOAP /REST protocol which defines the communication and structure of messages, and XML/JSON is the data format.
Web services are designed to allow applications built using different technologies to communicate with each other without issues.
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.
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.