All IT Courses 50% Off
JAVA Tutorials

How to Test Web Service using SOAP UI?

Using SOAP UI, automated tests can be created for web services and Test Web Service using SOAP UI.

In this article, we will

  • Create a SOAP project using SOAP UI
  • Create Assertions in SOAP UI
  • Build an automated test using SOAP UI

First, you need to install SOAP UI from the URL

Create a SOAP project:

Step 1: Open SOAP UI.

Step 2: Press Ctrl + N to create a new project.

Step 3: Run the project and go to http://localhost:8080/ws-doc/.

Step 4: Enter the URL of WSDL in the field of Initial WSDL. The field Project Name will automatically get filled.

Step 5: Click on, OK. It will then create a new project.

Build a Test Suite, Test Case, and Test Step:

Step 1: Press Ctrl + T to create a new test suite.

Step 2: Click on, OK. Select the name of your Test Suite and press Ctrl + N to create a new Test Case.

Step 3: Click on, OK. Expand the Test Suite and Test Case. Right-click on the Test Step > Add Step > SOAP Request.

Step 4: Enter the name of the step and click on, OK.

Step 5: Select the option CustomerWebserviceSoap -> GetCustomers and click on OK.

Step 6: Again, click, OK.

Step 7: Open the SOAP request Retrieve Customers.

Step 8: Change the value from




Step 9: Press Alt + Enter to submit the request. The response will be:

<soap:Envelope xmlns:xsd="" xmlns:xsi="" xmlns:soap="" xmlns:tns="">
                <Name>Jessica D. Rogers</Name>
                <Address>2118 Collins Street</Address>
                <ZipCode>PA 16646</ZipCode>
                <Name>Jamie S. Wentz</Name>
                <Address>3269 Village View Drive</Address>
                <ZipCode>MD 20872</ZipCode>
                <Name>Blake G. Race</Name>
                <Address>4437 Sunny Glen Lane</Address>
                <ZipCode>OH 44115</ZipCode>
                <Name>Angela L. Dolly</Name>
                <Address>3718 Alpha Avenue</Address>
                <ZipCode>TX 75439</ZipCode>

Create Assertions:

Step 1: Click Assertions (1).

Step 2: Click on the icon Add Assertion.

Step 3: Click Property Content > XPath Match. Enter the expression count(//Customer) and click on Save.

Extend your Test Case:

Step 1: Add a new Soap Request to the already available test cases.

Specify name for stepCreate Customer
Select operation to invoke for requestCustomerWebServiceSoap -> CreateCustomer

Step 2: Change the request.

<soapenv:Envelope xmlns:soapenv="" xmlns:exam="">
         <Name>Donald A. Hylton</Name>
         <Address>784 Better Street</Address>
         <City>Kansas City</City>
         <ZipCode>KS 66102</ZipCode>

Step 3: Add a Contains Assertion and enter true.

Step 4: Right-click on the test case, Retrieve Customers. Select the option Clone Test Step. Change the Test Step name to Retrieve Customers 2 and click on OK.

Step 5: Open Test Step Retrieve Customers 2. Click on Assertions (2). Open XPath Match – Unknown. Change the Expected Result to 1+ and click on button Save.

Run the Test Case:

Open Test Case TestCase 1.

Click on the icon Run this Test Case.
Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button