In the preceding tutorial, we delved into the attributes of SoapUI Pro and gave a brief comparison of SOAP and REST web services. This guide will elucidate further on SOAP (Simple Object Access Protocol) and REST (Representation State Transfer) based services and their respective merits.
=> For a comprehensive catalog of SoapUI and SoapUI Pro tutorials in this sequence, click this link.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
Comprehending REST and SOAP Services:
A web service essentially acts as a medium enabling the interaction between two computers over the World Wide Web. Web services are software components enabling machine-to-machine interaction across a network. This compatibility is accomplished through a WSDL document that can be understood by a machine. SOAP takes the WSDL document and transmits it via HTTP in an XML format.
Consider this graphic representation of the web service flow.
What the Tutorial Covers:
What Constitutes a SOAP Service?
SOAP is a protocol stipulating a set of rules for exchanging structured information via web services. SOAP employs XML format data that is platform-independent and compatible with principal protocols such as HTTP, FTP, TCP, and UDP.
SOAP services conform to standards for sending and receiving messages in a specified format. Standard elements of a SOAP message include:
- Data for Request / Response
- The action to be taken
- Header data
- Error details in case of failure messages
In SOAP, services relating to security and provided by WS-Security standards are available on both client and server ends. WS-Security administers data integrity and confidentiality. Another feature, WS-ReliableMessaging, renders reliable services for both success and failure scenarios.
WSDL is the primary technique employed for managing SOAP service data.
What is REST (Representational State Transfer)?
REST is an architecture specifically tailored for networking applications and is employed in client-server systems for sending requests and responses. REST services, also recognized as RESTful APIs, are implemented using the Hypertext Transfer Protocol (HTTP). REST services are independent of the GUI and REST APIs can be tested using SoapUI without the actual application. It operates on a stateless principle, implying that when the client sends a request to the server, no data is stored in the session.
SOAP vs. REST
- SOAP is a protocol, while REST is an architecture. SOAP empowers us to deliver SOAP envelopes to REST-based applications.
- REST facilitates different message formats, however SOAP strictly allows XML only.
- REST services are more rapid and seamless to manage.
- The requisite protocols for SOAP are tied up with SMTP and HTTP, whereas REST depends solely on HTTP.
- SOAP has a more protected and structured format.
- REST is independent of any particular standards as it facilitates various messaging formats like JSON, CSV, and XML.
- SOAP web services enable us to construct the client using RESTful services.
- SOAP was introduced for distributed computing.
- Upon its inception, REST adjusted the web with its performance and scalability as it is a lightweight component.
- REST is stateless, while SOAP has a stateful specification.
- REST uses Uniform Resource Identifier (URI) and has methods like GET, PUT, POST, and DELETE to reveal its resources.
- SOAP uses named operations and interfaces to accomplish its business logics.
Now, let’s delve into REST services by setting up a REST project in SoapUI Pro.
Setting up a REST Project in SoapUI Pro:
Brief steps:
- Launch the SoapUI Pro application and right-click on the Projects node in the Navigation panel.
- From the context menu, select the New REST Project option.
- Key in the following Google Map API location in the provided text box: http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
- Click OK, and SoapUI Pro will generate a project tree with resources, services, methods, and endpoints including input request in the editor. Refer to the illustration below:
(Click on the image for a magnified view)
In the screenshot above, you can view the parameters section. Clicking on it will display the parameters used in the service in a separate popup window.
Now, let’s run this service by clicking the Run icon. SoapUI Pro will generate the ensuing output for the given endpoint in XML format.
(Click on the image for a magnified view)
Functional testing for the Google Map API is now concluded. Let’s add test suites and test cases to delve deeper into REST services.
To incorporate a test case, adopt these steps:
- Click on the icon to append a test case request.
- Input the test suite name and click OK.
- Next, specify the test case name and click the OK button.
- In the Add Request to Testcase dialog, supply the request name and click the OK button.
- Now, the test suite tree will appear as shown below:
Execute the test suite by double-clicking on the test suite name. The results of the test suite will be displayed.
To obtain the test results report, click the icon from the toolbar.
In the Create Report window, ensure the format is selected as TestSuite Report. The JUnit-Style HTML Report format can also be used. Click the OK button and validate the results.
In a similar fashion, we can append REST services, resources, and methods. We can incorporate any number of resources in the resource path.
Proceed by adding a REST service:
- Right-click on the interface name, which is represented as http://maps. Googleapis.com.
- Select the New Resource option from the context menu.
- In the New REST Resource window, key in the resource path as http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false
- Click OK.
- Now, the request is appended under the project tree. It can be renamed as needed to represent a specific query.
- In the Form tab, modify the address to 2176 Heron Way, Portland, OR.
- Click the icon to check the results. Refer to the following screenshot.
Contrasting SOAP and REST Services
Now that you are familiar with adding REST resources, here is a breakdown of the differentiating points between SOAP and REST services:
<
div id=”tablepress-33-scroll-wrapper” class=”tablepress-scroll-wrapper”>
<
table id=”tablepress-33″ class=”tablepress tablepress-id-33 tablepress-responsive”>