[Part 02] API Testing Basics: SOAP API

API Testing Basics SOAP API

Table of Contents

API Testing Basics: SOAP API & REST API

The World Wide Web Consortium (W3C) and its collaborators created the messaging standard, SOAP, or Simple Object Access Protocol. XML is used as the data format to define request and answer messages. XML Schema and related technologies ensure the data’s structure and consistency.

What is SOAP API?

SOAP is a common interface used by private and public Application Programming Interfaces (APIs). All types of businesses create and use SOAP APIs, though they are more common in bigger organisations.

Four unique aspects are provided by SOAP, which utilises XML as the data format for messages delivered and received by an API client:

  1. Envelope: The envelope defines the message’s structure.
  2. Encoding: Rules for defining the nature of data are called encoding.
  3. Requests: How is each SOAP API request structured?
  4. Reactions: How each SOAP API response is structured.

Making SOAP Requests with Postman

In Postman, you should select the HTTP POST method to send a SOAP request. SOAP requests are typically sent using the HTTP POST method because the SOAP message, including the request envelope and data, is included in the body of the POST request. Here’s how to send a SOAP request in Postman:

  1. Open the Postman application.
  2. To open an HTTP request, select New > HTTP.
API Testing Basics SOAP API
  1. Enter your SOAP endpoint URL in the address field. For this example, use the following endpoint URL:

https://www.dataaccess.com/webservicesserver/NumberConversion.wso

  1. From the list of available request methods, choose POST.
API Testing Basics SOAP API

Adding body data

  1. Select raw from the Body tab and XML from the dropdown menu.
API Testing Basics SOAP API
  1. In the text entry field, enter your XML. The following XML should be entered in the text entry box to test the number conversion SOAP API used in the previous section:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NumberToWords
xmlns="http://www.dataaccess.com/webservicesserver/">
<ubiNum>500</ubiNum>
</NumberToWords>
</soap:Body>
</soap:Envelope>

Your request body must include the SOAP Envelope, Header, and Body tags as required by the endpoint and any namespaces. The data must include the operation’s name and any values you must post to the service.

Setting your request headers

Postman automatically adds an application/xml content-type header when you specify an XML body type. But for some SOAP calls, you may need text/xml, depending on your service provider. To determine which header is suitable, check with your SOAP service. If the text/xml header is required, change Postman’s default configuration.

To set request headers, do the following:

  1. Open the request Headers. If the auto-generated headers are hidden, select hidden to display them.
  2. Clear the Content-Type header, which was automatically added.
  3. Add a new key-value pair, content type, and text/xml.
  4. Add another key-value pair, SOAPAction and “#MethodName”(in this example, “#POST”).
API Testing Basics SOAP API

Sending your request

Select Send to make your call to the SOAP service. Postman displays the response in the lower tab if your call is successful.

API Testing Basics SOAP API

If we follow the steps properly, according to the provided request, a response message will be displayed to the user along with the expected result. To identify the response message, please visit the following link and check out what the response message is trying to say:

Reference:

Previous Part:

Next Part:

Share this Article To your friends

2 Responses

Leave a Reply

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

Our Blog

Our tips and solutions in SQA services

Future-Proof Your Software

QA Harbor's Gift To You A Free QA Consultation!

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Who are going to assist you!

Masudur Rahaman

Managing Director

Farzam Aidelkhani

Biz & Sales Lead

Zabir Ibne Mizan

Business Analyst