Many of us have used a currency converter online irrespective of web technologies used to develop the website… But same web service work on all these sites. How is it possible?
This was possible due to the concept of Web Services which provides an interface to all programming languages to communicate with each other. So let’s understand this Web Services. So be ready to learn about Web Services, It’s Type and Architecture.
What is Web Services?
In Simple Term, Web Services are an independent software system designed for interoperability between machine to machine over the network. Web Services open up a way to expose the functionality of an information system and make it available through standard Web technologies(HTTP or HTTPS). It also reduces heterogeneity due to standard web technologies use and is, therefore, key to facilitating application integration. Furthermore, we show that Web services naturally enable new computing paradigms and architectures, and are specifically geared toward service-oriented computing, a paradigm often touted in the past but never quite realized.
The definition is written before seems complete but let’s see the definition by UDDI consortium
Web services are “self-contained, modular business applications that have open, Internet-oriented, standards-based interfaces.
Above definition is more detailed, placing the emphasis on the need for being compliant with Internet standards. In addition, it requires the service to be open, which essentially means that it has a published interface that can be invoked across the Internet. In spite of this clarification, the definition is still not precise enough. For instance, it is not clear what it is meant by a modular, self-contained business application.
So Definition of the UDDI consortium has been enhanced by W3C and the definition is as below
A software application identified by a URI, whose interfaces and bindings are capable of being defined, described and discovered as XML artefacts. A Web service supports direct interactions with other software agents using XML-based messages exchanged via Internet-based protocols.
In a common way, we can say Web-Services communicate with numerous apps with HTML, WSDL, SOAP and other standard protocols where it XML is used to tag the data provided in message and SOAP transfers this data/message but WSDL provides details about its accessibility.
But before moving ahead, Why not see Why XML is so reliable for data transmission.
XML provides a standard method to access information, making it easier for applications and devices of all kinds to use, store, transmit, and display data.
After the above lines, It is pretty clear why web services use XML to send or receive the messages in the form of request and response within all connected application with web services.
We have seen in the above line that XML is used as a request and response. Therefore there will be a certain standard of defining each request message and there will be certain interfaces that will be opening doors to map information from the various application, object and business functions. That is why for exposure of any web services, structure definition for the correct setting/set of the message as request and response will be a must and this will be helping other applications to discover such services easily for integration as Middleware.
Now let’s see the list of benefits that XML keeps open for web services
1- XML message is independent of programming language and platform, So are web services. It can interact with any application either is a desktop or handheld device.
2- It can reduce the cost of operation. Because these services are exposed by one organization can be used/integrated easily by some other organization. Due to such facility newer or smaller companies can work on their core functionality development without thinking much on these services.
3- Solution deployment would be fast.
Type of Web-Services.
There are mainly two types of Web Services
What is SOAP Web Service?
SOAP stands for Simple Object Access Protocol. SOAP Service is XML based messaging protocol for information exchange between two computers or applications which are connected through network. Here we should remember that XML is being used for information exchange, It means this protocol is independent from language and platform.
So if we explain above paragraph, then it is clear that soap services written in any programming language can be embedded or called from any other language and this is good for keeping the development cost low.
What to remember about SOAP Services.
1- SOAP stands for Simple Object Access Protocol
2- It is W3c Recommendation
3- It is XML based protocol that relies on application layer protocol mainly on HTTP but some older services might be using Simple Mail Transfer Protocol(SMTP) for message transmission and negotiation.
4- SOAP services use specific messaging format to send and receive the information.
5- SOAP services are platform independent.
Advantages of SOAP Services
1- SOAP binds with any transport protocol easily and this has been possible due to its neutral characteristics, Now these days, it is popularly used with HTTP but it can be used with SMTP, JMS and message queues.
2- Since SOAP uses HTTP and due to this there is no need of any other computing firewall or proxy handling. So no additional computing infrastructure needed to start with SOAP services.
3- It is light weight protocol because of XML. Due to XML facility, So internalization and XML namespace extensibility is part and parcel of this protocol.
Disadvantages of SOAP Services
1- It uses XML and these services doesn’t share support for other lightweight format support like JSON.
2- SOAP services are contract based, So client and server applications are tightly coupled.
3- These services are quite slow due to large payload for normal communication and this is all done by XML.
What is RESTful Web Services?
REST stands for Representational State Transfer and this is rest architectural web services. Such services use HTTP to implement rest architecture.
REST is a stateless client-server architecture. Every single content is known as resource and these resources can be accessed through a specific URI. To invoke Restful web services, Client applications normally use HTTP GET/POST methods. So here we could see that HTTP/HTTPS is used for communication between client and server and due to this it is called lightweight web services… REST uses XML, JSON, text or any other format for exchange in information.
Advantages of REST
Listing some of the advantages of using Rest Web Services.
1- This is lightweight because it is an architecture not the complete protocol like SOAP.
2- It supports multiple formats like XML, JSON, Text and many other formats.
3- REST methods can be tested through browser as well.
Hope you have enjoyed this post, if you want to read some of the FAQ then hope this post Top 16 REST API Testing Interview Questions With Answers!! will help you.