(In the first part of this series, we discussed about web services and SOA. In this part, we would talk about web services technologies).
Web services technologies
If we re-visit the web services definition, we can notice the following terminologies:
- XML Serialization
Let’s try and understand these terms in details:
SOAP (Simple Object Access Protocol)
SOAP is a specification or standard for exchanging information between the service consumer and the service provider. Every SOAP message comprises of a SOAP header and a SOAP body, an XML based information set as shown in the diagram below:
If we look inside, we can see that the header and body messages are simple messages. Below picture shows the actual structure:
As you can see, the SOAP messages are tag based structures very similar to XML.
Now, Let’s take an example of a SOAP message. In this the service consumer is any user, who would like to know the current rate for the apples. The service provider in this case is a Fruit Mart rate service, as shown below:
Now let’s look at the SOAP messages, which will be exchanged between the service consumer and the provider. First let’s see the SOAP request:
You can see a TAG <m:Item>Apples</m:Item>. This TAG tells the web service provider that the consumer wants to know the rate for apples. The web service provider will get the rate and form a SOAP response as shown below and will send it to the consumer.
Web Services Description Language (WSDL)
In web services parlance, A service provider describes its service using WSDL. Why is this definition required? This definition is required so that the web service can get registered with a Registry. Registration with a registry is required as that’s the only way a web service consumer can find it.
With the help of WSDL, 3 key properties of a web service is published:
- What does a service do? What are the operations or services provided?
- How can the service be accessed? This will contain information like data format and protocol details.
- Where is the service located? This is described in the format of an URL.
The WSDL description for a web service will have the following structure:
A web service consumer uses the WSDL to send a request to the service provider as a SOAP request. The service provider provides the expected response to the service consumer as a SOAP response.
Universal Description, Discovery, and Integration (UDDI)
We have mentioned registry in this chapter several times. Now we are going to see what is UDDI? The UDDI registry was intended to be a registry or directory of web services. Every web service is registered with a UDDI directory and each web service is described using WSDL as discussed in the previous section. An alternative to UDDI is the ebXML Registry.
We have discussed 3 key technologies related to web services namely SOAP, UDDI and WSDL. Let’s see how all of these work together.
The figure above provides set of technologies which make the web services work. However, these are not the only way in which web services can be implemented and consumed. We have alternatives. The alternatives for SOAP is REST API and JSON, where ebXML is the alternative for UDDI registry. Discussion of REST API and JSON is beyond the scope of this book.
Having discussed the basics of web services, you must have realized that they play an important role in modern day software applications – for both Internet based applications as well as Enterprise applications. Without doubt, it also implies that the testing of web services also becomes important from that perspective.
We will discuss further in the second part of this tutorial