How to use SoapUI for testing API
Welcome to my first blog, I am writing this blog to capture my experience of my first project with API testing using SoapUI tool with little of prior knowledge.This blog will include how to setup and how to use SoapUI tool (Create project using WSDL & Run) with sample web services. Hope this will help the first time user.
SoapUI is a tool to test REST and SOAP based web services.
Running your first API test in SoapUI tool? For first-time users, the process looks something like this:
Set up SoapUI.
Get started with your first project with Sample WSDL.
Run a test.
Let get started!!
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.
#1 Calculator API
You will need the sample WSDL URL : "http://www.dneonline.com/calculator.asmx?wsdl"
What is a WSDL?
WSDL, or Web Service Description Language, is an XML based definition language. It’s used for describing the functionality of a SOAP based web service.
Create Project From sample WSDL
Step#1: Launch the SoapUI tool from Icon created on your desktop.
Note : You will be prompted with Endpoint Explorer window when it is launched for the first time, you close it.
Step#2: Lets take a closer look , create a new project and import a sample WSDL file, In SoapUI, click or select File > New SOAP Project
Step#3 : In the dialog box, specify the following URL in the Initial WSDL field:
Step#4: Leave the default settings and click OK
SoapUI will load the specified WSDL and show its contents into the following object model:
Step#5: Go to the first “Request 1” by expanding the Add operation and double-click it, which opens the following window:
Step#6: 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.
You might come across ERROR, If you have provided invalid input, In that case the RAW output will look like below,
After learning how to create project with WSDL and Run, We had given an exercise to perform same task with different Soap-WSDL.
#2 German Bank Code Service RPC API
For this exercise we had given URL to find WSDL link, https://www.programmableweb.com/api/german-bank-code-service-rpc-api
We had to find the WSDL from the page and run Request and get the Response as we did in Calculator API exercise.
Step#1: Find the API URL with WSDL from the given webpage. In page you can fine under "SPECS " section.
Step#2: Create new project as we learn for Calculator API, this time with WSDL: http://www.thomas-bayer.com/axis2/services/BLZService?wsdl
Step#3: Now, We have to find what input this API is taking?
For that, Read the web service description from the page, "BLZService is a simple German Banking Code lookup service. It uses SOAP protocol and responses are formatted in XML. The is little documentation aside from the WSDL. The main site is in German."
From description we can see that this web service is about BLZService that is German Banking Code lookup service, Let's try to find this code.
You can google "BLZService German Banking Code" and you will able to find about BLZ code, Now you can search for "List of BLZ code in Germany"
Step#4: Now all we have to do is enter input which is a BLZ code where "?" is shown and press the green arrow on the top left to submit the request to the service, which will return a response with bank details, it will be in RAW format so click on XML on Response window to see the XML format:
If you put incorrect input you will be prompted with an error in response.
So finding the correct input after the reading description is the key here, All other steps are same as we learn in Calculator API example.
Still the exercise is not complete as we have to learn about how to test using SoupUI with multiple inputs, as we can see for BLZ code example there is long list of BLZ codes.
Hope we can learn about that in next blog!!!!