To proceed with the next topic in the SoapUI tutorial series we are covering the most interesting topic called “What is Web Service Testing“. A web service in simple terminology can be defined as a service offered by an application installed on a particular device or server to another device or client application after communicating with each other through WWW (World Wide Web). Web Services generally uses HTTP or HTTPS protocol over the application layer of computer network where one application transfer data or send requests as XML or JSON and receives the response which is processed by the client application as a web service irrespective of underlying software platform, architecture and technology.
For example, an application written in .NET platform wants to access the data in the form of web service from an application in JAVA platform, this is possible through transfer of XML request and response between the applications.
Let’s understand how this is helpful in our day to day life in simpler manner. Suppose we have a broker application and want to display stock information for indexes. My application need not to collect the data and carve the graph of indexes, instead I may use the web service from any third party application keeping the live information about indexes and process the information on my website. Here I need to care about the host architecture and platform, just need to send the XML request using HTTP/HTTPS/ protocol over www and process the XML response to display desired stocks indexes on my website. This resolves the complexities of developing and maintaining complex programs in one’s application which is simplified with the use of web services as plug and play operation from third party vendor which is maintaining such program as web service.
Web Service identified as:
- Any service which is available on internet or intranet or virtual private network (VPN).
- A service that uses standard XML message format.
- A service which is platform independent as well as not restricted to particular operating system or programming language.
- A service which can be discovered by simple find mechanism over World Wide Web which is a URL.
- A service which self-describe through common XML grammar.
- A service capable of exchanging information via HTTP or HTTPS protocol over World Wide Web.
Web Services Components:
The basic web services platform is XML message format and HTTP request and response. All the standard web services work using the following components
- SOAP (Simple Object Access Protocol)
- UDDI (Universal Description, Discovery and Integration)
- WSDL (Web Services Description Language)
Web services Operation:
A web service enables communication among various applications installed on different devices by using open standards as discussed below:
- HTML page to send the request and render the received the response via HTTP/HTTPS protocol.
- XML to tag the request and response data.
- SOAP to transfer a message over the web.
- WSDL to describe the availability of web service.
Web services Example:
Consider a banking web services that registers the user and generates unique user id and password to access their account on their website. Suppose a user registers himself online for the first time after opening an account with the bank. The banking web service is a JAVA program that resides on the Solaris machine that interacts with the database for processing the data received from the JSP application which registers the users online through World Wide Web.
Below are the steps which will be performed by this operation:
- The client program running as JSP application bundles the user details like his name, phone number, email id, address and bank account number received offline into a SOAP message.
- This SOAP message is sent to the web service via the HTTP POST request over World Wide Web.
- The Web service unpacks the SOAP message, parse the XML message and generate a command line commands that processes the request and interacts with the database.
- Server side program embedded in Web service after database look up validates the data and if information is correct then creates the unique UID and Password and bundles this data into another SOAP message as response.
- This response is sent back to the client JSP application as SOAP message using HTTP POST response.
- SOAP message is unpacked, validated andparsed by the client program.
- If validation of SOAP message is successful, the client JSP program processes the SOAP message data. Client program renders the information such as“UID and password successfully created” on the web browser screen and sent this actual information (UID and password) through an email or as a SMS on phone which user had registered with the bank.
- If validation of SOAP message fails then web service will send the error information in the SOAP message which will be rendered on the web browser screen like “Input data does not match the details requested, UID and Password not created”.
- This is how the web service operation of generating UID and Password for a banking application gets completed. Below is the pictorial representation:
Web Service Request and Response model
Web Service Testing: In the last tutorial, we discussed about SoapUI tool which is used to test the web services and Web APIs. In this tutorial we are going to discuss what actually the web services testing involves:
- WSDL file definition understanding.
- Operations provided by the Web Service.
- XML Request message format that sent as SOAP request message.
- XML Response message format received as SOPA response message.
- A simple local tool or test program that could send XML message request and receive request as XML message response.
We are going to discuss above testing steps in detail in our next tutorial series “Web Service Sample Project and its Testing”. Most of the time in the tutorials the term Web service and Web API will be used therefore let’s understand the difference between Web Services and Web APIs as demonstrated below:
Differences between Web Services vs Web API:
|Properties||Web Services||Web APIs|
|Data Structure for information exchange||Only XML formatted is used as a structured data for information exchange and communication.||Structured data could be XML formatted, JSON formatted or plain data.|
|Data and Request Compression||HTML request can be compressed but XML data cannot be compressed.||Here data can be compressed.|
|Defined Standard for data||Standard are defined by WSDL (Web Service Definition Language).||No defined standard.|
|Example of Protocol used||Web services used SOAP (Simple Object Access Protocol) protocol||Web APIs uses REST (Representational State Transfer) protocol|
In today’s part of tutorial we learned about Web Services and How it is tested. There are different components are used in the Webservices testing like SOAP, UDDI, WSDL. The web service testing is more concentrating on Web Service Request and Response model. Many testers do not understand the exact difference between Web Service and Web API testing, here we covered difference between them.
Next tutorial >> Tutorial 3 – Web Service Sample Project and its Testing
If you are don’t want to miss the SoapUI tutorial updates then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below: