How to Create REST Project in SoapUI Pro: Tutorial #13

By Vijay

By Vijay

I'm Vijay, and I've been working on this blog for the past 20+ years! I’ve been in the IT industry for more than 20 years now. I completed my graduation in B.E. Computer Science from a reputed Pune university and then started my career in…

Learn about our editorial policies.
Updated November 9, 2024

This tutorial talks in detail about SOAP (Simple Object Access Protocol) and REST (Representation State Transfer) based services and their advantages. Let’s get started.

In an earlier tutorial, we discussed the features of SoapUI Pro and briefly touched upon SOAP vs REST web services. 

=> Click here for the complete list of SoapUI and SoapUI Pro tutorials in this series.

Understanding REST and SOAP Services

A web service is a program that helps us to connect two computers over the World Wide Web. It is a software component that supports machine to machine interaction over a network. This is called interoperability which can be achieved by machine-understandable format document called WSDL. WSDL is processed by SOAP and it transfers via HTTP in the form of XML.

SOAP and REST

soap vs rest services

Look at this pictorial representation of the web service flow.

SOAP vs REST Services 1

What is SOAP Service

It is basically a protocol which has a set of defined rules to transfer the structured information implemented through web services. SOAP uses XML format data which is platform-independent so it can support all the major protocols such as HTTP, FTP, TCP, and UDP and so on.

SOAP services follow the standards for sending and receiving messages in a unique format. Usually, SOAP messages contain the following information:

  • Request / Response Data
  • Actions to be performed
  • Header information
  • Error details if there are any failure messages

In SOAP, security-related services given by WS-Security standards are on both the client and server-side. WS-Security offers data integrity and privacy. WS-ReliableMessaging is another feature that provides end-to-end reliable services for success and failure cases.

WSDL is a major technique for handling SOAP service information.

What is REST (Representational State Transfer)

It is architecture based specially designed for networking applications and is used in client-server systems to send requests and responses. REST services are also referred to as RESTful APIs as they are implemented using Hypertext Transfer Protocol (HTTP). It is GUI independent and we can test REST APIs using SoapUI without the actual application. It follows a stateless method which means, whenever the client sends the request to the server, the server does not store any data in the session.

SOAP vs. REST

  • SOAP is a protocol and REST is architecture. This allows us to send SOAP envelopes to REST-based applications.
  • REST supports different message formats but SOAP permits XML only.
  • REST services are faster and easier to handle.
  • SOAP is tied to SMTP and HTTP protocols whereas REST relies on HTTP only.
  • SOAP is a more secure and structured format.
  • REST does not depend on any specific standards as it supports various messaging formats like JSON, CSV and XML.
  • SOAP web services allow us to build the client with RESTful services.
  • SOAP was introduced for distributed computing.
  • After REST’s entry, it accommodated the web by its performance and scalability as it is a lightweight component.
  • REST is stateless whereas SOAP is a stateful specification.
  • REST uses Uniform Resource Identifier (URI) and it has methods like GET, PUT, POST and DELETE to expose their resources.
  • SOAP uses named operations and interfaces to achieve its business logic.

Now let’s discuss REST services by creating a REST project in SoapUI Pro.

Creating REST Project in SoapUI Pro

Follow the steps given below:

1) Open the SoapUI Pro application and right-click on the Projects node present in the Navigator panel

2) In the context menu, click on the New REST Project option

3) Enter the following Google Maps API location in the given text field http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false

4) On OK, SoapUI Pro will create a project tree along with resources, services, methods, and endpoints with input request in the editor. 

(Click on the image for an enlarged view)

SOAP vs REST Services 2

5) As you can see in the above screenshot, there is a parameters section. If you click on it, it will show you the parameters that are used in the service in a separate popup window.

6) Now let us execute this service by clicking on the Run properties with groovy Script icon. SoapUI Pro generates the following output for the given endpoint in the form of XML.

(Click on the image for an enlarged view)

SOAP vs REST Services 3

We are done with functional testing for Google Maps API. Let’s add test suites and test cases to get to know more about REST services.

To add a test case, you have to do the following:

1) Click on the SOAP vs REST Services 8 icon to add a test case request

2) Enter the test suite name and then click OK

3) Then provide the test case name and click the OK button

4) In the Add Request to Testcase dialog, enter the request name and then click the OK button

5) Now the test suite tree will look like this.

SOAP vs REST Services 4

6) Run the test suite by double clicking on the test suite name

7) Here is the test suite results

SOAP vs REST Services 5

8) To get the test results report, click on the SoapUI pro features 12 icon from the toolbar.

10) In the Create Report window, make sure the format is selected for the TestSuite Report

11) Or else you can use JUnit-Style HTML Report format

12) Click the OK button to verify the results

SOAP vs REST Services 6

Similarly, we can add REST services, resources and methods. As discussed, we can have any number of resources in the resource path.

Let’s start with adding REST services

  • Right-click the interface name which shows as http://maps. Googleapis.com
  • Then click on the New Resource option from the context menu
  • It opens the New REST Resource. Then enter the resource path as http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
  • Click OK
  • The request has now been added under the project tree. If we wish, we can rename it to be meaningful
  • In the Form tab, change the address to 2176 Heron Way, Portland, OR
  • Click on the properties with groovy Script icon to view the results. Refer to the following screenshot.
SOAP vs REST Services 7

Difference Between SOAP and REST Services

Now you know how to add REST resources. Here I have summarized the differences between SOAP and REST services.

SOAPREST
SOAP is abbreviated as Simple Object Access ProtocolREST stands for Representational State Transfer
It is basically XML based message transfer protocolREST is standard architecture to build web services.
Request and Response data are used in the form of XMLREST service request and response data can be JSON, CSV and XML
It is complicated whenever the WSDL file is changed because we need to re-generate WSDL to build the client accordingly.We can use REST APIs without disturbing the existing client.
SOAP is tied with HTTP and SMTP protocolsREST relies on only HTTP
Do not have built-in error handlerSupports error handler for identifying the faults during run-time
SOAP messages cannot be cached when it readsREST data can be cached

Conclusion

So far in this tutorial, we learned SOAP and REST services as well as their advantages and differences.

We can also add assertions for the REST services to assert our services. We can add any number of REST test steps and transfer the data between each with the property transfer.

In the next SoapUI Pro tutorial, we will learn all about Data Driven Testing.

Please let us know your feedback and questions in the comments section below. We would love to hear from you.

Was this helpful?

Thanks for your feedback!

Recommended Reading

  • 4 Important Features of SoapUI Pro for Pro Audience – SoapUI Tutorial #12

    In this article, we will look at the 4 important features of SoapUI Pro for Pro Audience. Let's get started. SoapUI comes in two versions - Open Source Free (SoapUI) and SoapUI Pro (now SoapUI NG pro). So far we were discussing common automation concepts and functional testing basics such…

  • How to Create and Execute

    This is the 4th tutorial of this SoapUI training series.  Here, you will learn how to create and execute your first SoapUI project using WSDL.  In the previous SoapUI tutorial, we discussed the SoapUI and SoapUI Pro installations.  You will learn Creating SOAP project- adding WSDL during creation or after…

  • How to Perform Data Driven Testing in SoapUI Pro – SoapUI Tutorial #14

    In this article, we will learn in detail how to perform data driven testing in SoapUI Pro. Let's get started. In this SoapUI Pro tutorial, we are going to see Data Driven Testing using SoapUI Pro. Performing load testing and performance testing with huge amounts of data is often time-to-consumer.…

  • Soapui and pro features

    In this article, we will look in detail at the 7 important features of SoapUI and SoapUI Pro. Let's get started. SoapUI is a great tool for functional testing, web service testing, security testing and load testing.  This is the 2nd tutorial in our SoapUI web service testing tutorial series.…

  • How to Create a New Project in Appium Studio for Eclipse

    How to create a new project in Appium Studio for Eclipse: Simplify your Appium testing with a quick configuration of your Java project. This tutorial is a part of our Appium Studio hands-on tutorial series and it will brief you more on the steps involved in creating a new project…

  • soapui tutorials

    In this article, we have compiled a list of Soap UI Tutorials for the benefit of our readers. Let's get started. STH is coming up with another testing tool tutorial. You know how detailed and useful these tutorials are. The tools are SoapUI and SoapUI Pro. We suggest that our…

  • create and run java proj

    This Tutorial Explains How to Create a New Java Project and Run it as a Java Application in the Eclipse IDE: In the previous tutorial of this Java Eclipse tutorial series, we have learned to Install Eclipse by downloading the Eclipse IDE (Photon) and setting up a workspace for it.…

  • 3. Create and Insert Database

    A Complete Guide to Create and Insert Database in MongoDB: Our previous tutorial in this Free MongoDB training series explained to us all about the Installation of MongoDB on Windows. In this tutorial, we will see how to Create & Insert Database in MongoDB. The most basic step in MongoDB…


8 thoughts on “How to Create REST Project in SoapUI Pro: Tutorial #13”

  1. @Sanjeev kumar: For performance, usability wise REST services better and security purpose SOAP can be used.

    Reply
  2. Hi Team,
    Im really interested in learning Ziggy to test REST services.DO u guys have ny supporting article?I hardly can find related articles in internet also.Please let me know some information

    Thanks
    Nima

    Reply

Leave a Comment