From the course: Java EE 7: Web Services

Web services overview - Java EE Tutorial

From the course: Java EE 7: Web Services

Start my 1-month free trial

Web services overview

- [Instructor] Similar to communicating with a friend, two systems on the Internet can talk and share data with each other. Data is shared via web services, and web services share a common language, like XML or JSON. Let's learn about web services, how they communicate, and the advantages to using them. A web service is a software application available over the Internet, used as a means of communication between different software applications running on a variety of platforms and frameworks over a network. Web services are designed to communicate with other programs or applications, rather than directly with users, and can be remotely invoked. A web service allows two disparate systems, potentially running on different servers, to communicate. In essence, web services allow various applications to talk to each other and share data amongst themselves. These systems could be a combination of Windows or Linux servers, mobile devices, mainframe computers, desktop computers, smartphones, or even another web service. The means of communication between the two systems is via a standard web protocol like HTTP, or HTTPS, via the World Wide Web. There are two main types of web services. SOAP-based web services. SOAP stands for Simple Object Access Protocol. SOAP is an XML-based web service protocol for accessing web services. RESTful APIs. REST stands for Representational State Transfer. REST is an architectural style and approach to communications often used in web service development. There are two parties involved in the communication. There is a web service provider, the device, system, or organization providing the data or information, and the service client, the device consuming or requesting the data or information. How does it work? Step one, the web service provider defines a format for requests for its services, and also the response the service will generate. Step two, the service client device makes a request for the web service across the network. Step three, the web service performs an action, like query a database or perform a calculation, and sends a response back to the service client. While web services can provide data in a number of different formats, XML and JSON are the most common. These standard text-based formats can be easily recognized and parsed by another program that receives the data. Extensible Markup Language, or XML, has long been a popular way to structure data using a familiar markup language. JavaScript Object Notation, JSON, is a text-based data interchange format derived from the JavaScript scripting language. It is formatted as key-value pairs, and is more lightweight than XML. Web services provide language transparency. This means the service provider can write the web service in one language, like PHP, node.js, et cetera, while the service client could be written in a totally different language, like Python, Ruby, or Perl, and they can still communicate, because they speak the common language, XML or JSON. Web services offer many advantages. A few include an easy way to expose business logic and data to other systems in a secure fashion to a wide range of audiences and platforms. Another benefit, web service is a small, reusable component that can be used by multiple systems. This approach can even allow organizations to leverage web services provided by third parties to reduce their own development time, and deliver more powerful applications.

Contents