ABOUT:
Welcome to my first blog! I am creating my first blog on API Testing using Soap UI tool. Let's begin with the basic understanding of API and Soap UI Testing.
WHAT IS API?
API is Application Programming Interface. API helps in connecting two different application.
We required API keys to have communication between the both applications.
How API works?
The user initiates an API call that tells the application to do something, then the application will use an API to ask the web server to do something. The API is the middleman between the application and the web server, and the API call is the request
Why to use API?
API is used for transferring of your valuable data into your program.They work as the middle man, allowing developers to build new programmatic interactions between the various applications people and businesses use on a daily basis.
It allows the user or a company to customize the content and services which they use the most.
Software needs to change over time, and APIs help to anticipate changes.
APIs can access app components. The delivery of services and information is more flexible.
API helps two different software’s to communicate and exchange data with each other.
What are 3 most common API?
Today, there are three categories of API protocols or architectures: REST, RPC and SOAP.
What is SOAP?
SOAP stands for Simple Object Access Protocol.The main idea behind designing SOAP was to ensure that programs built on different platforms and programming languages could exchange data in an easy manner.
SOAP can only work with XML format. As seen from SOAP messages, all data passed is in XML format.
What is REST?
REST stands for Representational State Transfer.REST was designed specifically for working with components such as media components, files, or even objects on a particular hardware device.
What is RPC?
RPC stands for Remote Procedure Call. It is a methodology used for constructing distributed, client-server-based applications.RPC is action-oriented.It does not supports hypermedia and hyperlinks.Require payloads of a few data types as XML for XML-RPC.
What is Soap UI?
SoapUI is an open-source tool used for functional and non-functional testing, widely used in WebServices testing. Soap Ui is a testing tool.This is mainly used for manual and automation testing.Using Soap UI you can create a complete framework for API testing.
Why to use Soap UI?
1. To create quick and efficient API tests
2. To create API functional, performance and security tests
3. To create API Testing automation framework
SOAP - WSDL:
WSDL stands for Web Services Description Language.It is a standard format for describing a web service.
WSDL is pronounced as 'wiz-dull.The WSDL file is used to describe in a nutshell what the web service does and gives the client all the information required to connect to the web service and use all the functionality provided by the web service.
Structure of a WSDL Document
A WSDL document is used to describe a web service.This description is required, so that client applications are able to understand what the web service actually does.
The WSDL file contains the location of the web service and
The methods which are exposed by the web service.
The WSDL file itself can look very complex to any user, but it contains all the necessary information that any client application would require to use the relevant web service.
Below is the general structure of a WSDL file
Definition
TargetNamespace
DataTypes
Messages
Porttype
Bindings
service
The WSDL document actually tells a client application what are the types of SOAP messages which are sent and accepted by the Web service.In other words, the WSDL is just like a postcard which has the address of a particular location. The address provides the details of the person who delivered the postcard. Hence, in the same way, the WSDL file is the postcard, which has the address of the web service which can deliver all the functionality that the client wants.
Below is a diagram of the structure of a WSDL file
Installation:
SoapUI is a desktop executable available on all three major operating systems - including Windows, OSx, and Linux.
First, Go to download SoapUI open source and finish downloading file. After that double click on file and you will be presented with installation wizard,
Click through "Next" button and complete the installation with default settings.
Work with WSDLs in SoapUI:
To take a closer look at a WSDL file, create a new project and import a sample WSDL file:
Create Project From WSDL
Lets take Calculator WSDL File Example:
Step 1: In SoapUI, click or select File > New SOAP Project
Step 2: In the dialog box, specify the following URL in the Initial WSDL field
Step 3: Leave the default settings and click OK.
Step 4: SoapUI will load the specified WSDL and parse its contents into the following object model:
Note:- [ A WSDL can contain any number of services (the bindings). A binding exposes an interface for the specified protocol. In the example above, the WSDL file exposes two bindings: one for SOAP 1.1 (“CurrencyConverterSoap”) and one for SOAP 1.2 (“CurrencyConverterSoap12”).]
Step 4: Go to the first “Request 1 ” by expanding the Add operation and double-click it, which opens the following window:
Step 5: Now all we have to do is enter two integer value (intA, intB) where "?" is shown and press the green arrow on the top left to submit the request to the service, which will return a response, it will be in RAW format so click on XML on Response window to see the XML format:
The above step can be repeated for all the other operations with different inputs.