Skip to content

How To Send Soap Request Using Postman

API Testing Blog

How to Send SOAP Requests Using Postman

Postman is a popular tool for API testing, and it can also be used to send SOAP requests. This guide will walk you through the process, providing step-by-step instructions and practical examples.

Understanding SOAP and Its Structure

SOAP (Simple Object Access Protocol) is a messaging protocol that allows applications to communicate over a network. It defines a standard way for exchanging structured information in XML format.

Key Components of a SOAP Request:

  • Envelope: The root element that encloses the entire message.
  • Header: Contains information about the message, such as security credentials or routing instructions.
  • Body: Holds the actual data being exchanged, often encoded in XML.

Setting up Postman for SOAP Requests

Postman offers a dedicated “SOAP” tab designed for sending and testing SOAP requests. Here’s how to configure it:

  1. Create a New Request: In Postman’s interface, click on “New” and select “Request.”
  2. Choose the HTTP Method: Select “POST” as SOAP requests typically use the POST method.
  3. Add the URL: Enter the URL of the SOAP service endpoint in the “Enter request URL” field.
  4. Select “SOAP” Tab: Switch to the “SOAP” tab within the request.
  5. Choose the SOAP Action: Input the SOAP action in the “Action” field. The SOAP action identifies the specific operation being performed.

Example: Sending a Simple SOAP Request

Let’s demonstrate with a basic SOAP request to a weather service:

1. Sample SOAP Request (XML):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:GetWeather>
<tem:City>London</tem:City>
</tem:GetWeather>
</soapenv:Body>
</soapenv:Envelope>

2. Constructing the SOAP Request in Postman:

  • URL: https://www.webservicex.net/globalweather.asmx
  • Action: http://tempuri.org/GetWeather
  • Body (XML): Copy the above XML payload.

3. Sending the Request: Click “Send” to execute the request.

4. Inspecting the Response: In the response panel, you’ll see the XML data returned by the web service. In this case, the response would typically contain the weather information for London.

Sending SOAP Requests with Authentication

Many SOAP services require authentication to access their data. Here’s how you can handle authentication in Postman:

  1. Authentication Method: Choose the appropriate authentication method (e.g., Basic Auth, OAuth, API Keys) in the “Authorization” tab.
  2. Credentials: Provide the necessary credentials (username, password, API key) according to the selected method.

Customizing SOAP Requests

You can customize your SOAP requests further:

  • Headers: Add extra headers in the “Headers” tab to control request behavior (e.g., Content-Type, User-Agent).
  • Pre-request Scripts: Use JavaScript code in the “Pre-request Script” tab to modify the request before it’s sent.
  • Templates: Create reusable templates for frequently used SOAP requests.

Validating SOAP Responses

Postman offers ways to verify the accuracy of your SOAP responses:

  • Assertions: Use assertions in the “Test” tab to check expected values, response status codes, and more.
  • JSON Schema: Validate response data against a pre-defined JSON schema for structured validation.

By mastering these techniques, you can effectively utilize Postman for all aspects of SOAP API testing, streamlining your development and quality assurance processes.

API Testing Blog