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 March 7, 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

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

  1. Could you please continue the series for REST and go a little bit more details if possible .. thanks for sharing..

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

    Reply
  3. 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