Skip to content

Can Postman Be Used For Soap

API Testing Blog

Can Postman Be Used for SOAP API Testing?

While Postman is primarily known for its REST API testing capabilities, it can be successfully used for SOAP API testing as well. This guide will walk you through how to test SOAP APIs using Postman, providing practical examples and step-by-step instructions.

Understanding SOAP

SOAP (Simple Object Access Protocol) is a messaging protocol that relies on XML to exchange data between applications. It’s commonly used for web services that require robust security and transactions.

Setting up Postman for SOAP

  1. Install the SOAP Plugin: The first step is to install the Postman SOAP plugin. This plugin extends Postman’s functionality to handle SOAP requests effectively. You can find it in the Postman app’s plugin store.

  2. Select the SOAP Request Type: Once the plugin is installed, you can create a new request. In the Request Type dropdown, you’ll find the option for “SOAP.” Selecting this will enable the specific SOAP features within Postman.

Constructing SOAP Requests

  1. Define the WSDL URL: The first step in building a SOAP request is to provide the WSDL (Web Services Description Language) URL for the API you are testing. This file defines the available services, operations, and data structures. Include the WSDL URL within the “URL” field of the Postman request.

  2. Select the SOAP Action: After specifying the WSDL, use the “Action” field to choose the specific operation you want to execute. The SOAP plugin will populate this field with available actions based on the WSDL.

  3. Define the Request Body: The request body contains the data you’re sending to the API. This data should follow the XML schema defined in the WSDL. Postman provides syntax highlighting and auto-completion to help you construct the XML body correctly.

Example: Testing a SOAP Weather API

Let’s say we’re testing a SOAP API that provides weather information. Here’s how to construct a request in Postman:

1. WSDL URL:

https://www.webservicex.net/globalweather.asmx?WSDL

2. Action:

GetWeather

3. Request Body:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://www.webservicex.net/globalweather">
<soapenv:Header/>
<soapenv:Body>
<tem:GetWeather>
<tem:CityName>London</tem:CityName>
</tem:GetWeather>
</soapenv:Body>
</soapenv:Envelope>

4. Sending the Request: After setting up the WSDL, action, and body, send the request as you normally would in Postman.

5. Analyzing the Response: The response from the SOAP API will be returned as XML data. Postman will parse and display the response in a readable format, making it easier to understand the results.

Testing with Assertions

Postman allows you to add assertions to verify the correctness of the API response. This is crucial for automation and ensuring the functionality of your SOAP services.

Assertions Example:

  1. Check the Status Code: You can assert that the response status code is 200 (success).
  2. Validate the Response Body: Use the pm.expect command to check if specific XML elements are present in the response body and contain the expected values.

Conclusion

Postman, with the help of its SOAP plugin, provides a comprehensive way to test SOAP APIs. This blog post demonstrated how to set up Postman for SOAP testing, construct requests, and analyze responses. By using assertions, you can automate your SOAP API testing and ensure the reliability of your web services.

API Testing Blog