Learn free · topic 340
Web Service
Web Service is a service offered by an application to enable communication and data exchange at an application-level.
There are mainly two types of webservices used when integrating applications: REST and SOAP.
Web services are widely used in Data Integration. They allow real-time (or near-real-time) integrations and are suitable for use over the internet and in hybrid architectures (Cloud, SaaS, or on-premises).
In terms of architecture, web services enable the implementation of SOA (Service-oriented Architecture) and WOA (Web-oriented Architecture).
REST Web Services
REST, or Representational State Transfer, is a software architecture style for designing and communicating web applications.
A web service (or API) that follows REST principles is referred to as RESTful API. In the following sections, the terms REST web service and RESTful API will be used interchangeably.
A REST web service allows you to access a resource (data object, entity, etc.) via a URL (Uniform Resource Locator) [or web address].
REST web services employ a stateless protocol in a client-server architecture. Thus, sessions are not required.
REST web services can use multiple data formats, such as JSON or XML. JSON, however, is the most used format with REST web services.
REST web services can handle a variety of HTTP methods, including:
- GET: Get a representation of the target resource. The GET method is safe because it is a Read-only method and cannot cause the target resource to change. The GET method is also cacheable, which improves performance and scalability.
- PUT: Set the target resource as defined in the request (Create/Update).
- POST: Request the target resource to process the representation enclosed in the request.
- DELETE: Delete the target resource.
There are two major description languages that can provide a description of a given RESTful API’s structure and expected parameters: WADL, Web Application Description Language and WSDL, Web Services Description Language. WADL and WSDL are both XML-based. Other description languages exist, but none of them are widely deployed or recognized as the main standard. Still, when supplied, WADL and WSDL can help accelerate the development process.
SOAP Web Services
SOAP (Simple Object Access Protocol) is a messaging protocol for exchanging data in web service architectures over HTTP.
SOAP uses only XML formats in predefined schemas.
SOAP messages are XML (Extensible Markup Language) documents encapsulated into an envelope:
The envelope recognizes the XML document as a SOAP message. It is used to encapsulate all the parts of the SOAP message.
The header contains header information. Header information is structured in blocks. The header is an optional part. Examples of information that can be provided by the header include authentication credentials, definition of complex types, and other parameters that might be used or referenced by the message itself.
The Body contains the “useful” exchanged data.
Optionally, response SOAP messages might contain a Fault element.
Here is a simple example of a SOAP message.
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2001/12/soap-envelope" SOAP-ENV:encodingStyle=" http://www.w3.org/2001/12/soap-encoding">
<soap:Body>
<bookWebservice xmlns="http://domainname.org/">
<bookName>I am Data! Edition III</bookName>
</bookWebservice>
</soap:Body>
</SOAP-ENV:Envelope>
SOAP web services can be described and defined through WSDL (Web Services Description Language), an XML interface definition language.
The WSDL provides a complete description of the web service’s operations, as well as full technical definitions of its input and output parameters and data structures. It is sometimes referred to as the web service signature.
WSDL for SOAP is somehow equivalent to WADL for REST web services, even if technically WSDL can also be used with REST web services.
Finished reading? Test yourself with 10 questions on this topic.
Go to the questions →From I Am Datapedia! by Mustafa Qizilbash, published here free by the author. Nothing about your reading is stored.