Learn from experts and connect with global tech leaders at POST/CON 24. Register by March 26 to save 30%.

Learn more →
X

Making SOAP Requests with Postman

Avatar

Don’t forget to register here to attend POST/CON 24, Postman’s biggest API conference ever: April 30 to May 1, 2024 in San Francisco.

Lots of people call Postman “a REST client.” They’re not wrong. However, Postman is actually used for any calls sent over HTTP. Keep reading to learn how to use Postman to make SOAP requests. Since SOAP and GraphQL are agnostic with regards to the underlying transport protocol, Postman can handle these types of calls too.

It’s fashionable these days to talk about the REST (REpresentational State Transfer) architectural pattern, but a ton of developers still run on the older SOAP (Simple Object Access Protocol). Unless your organization is brand-new, chances are you’re developing and maintaining legacy codebases that rely on SOAP.

Related: REST vs. SOAP

Making SOAP Requests with Postman

If so, here’s how you can use Postman for making SOAP requests:

  1. Enter the SOAP endpoint as the request URL in Postman:
    https://www.w3schools.com/xml/tempconvert.asmx
  2. Set the request method to POST.
  3. Under the Body tab, set the body type to raw and select XML from the dropdown. Once you add XML data as the body, Postman will automatically add a Content-Type header that can be seen under the Headers tab. While REST typically uses JSON and other data formats, SOAP relies on XML.
  4. Under the Headers tab, add a new header where Content-Type is the key and text/xml is the value in order to override the one added for you in the previous step, since the endpoint we’re working with requires a different Content-Type header. You can deselect the originally added header.
  5. Back in the request body under the Body tab, define the SOAP envelope, body, and header tags. Start with the required SOAP envelope tag and define all the namespaces. Enter the SOAP body and headers. The name of the SOAP method (operation) should be specified in the SOAP body, as seen in the code block below. Then hit Send, and inspect the response.
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">

  <soap12:Body>

    <FahrenheitToCelsius xmlns="https://www.w3schools.com/xml/">

      <Fahrenheit>75</Fahrenheit>

    </FahrenheitToCelsius>

  </soap12:Body>

</soap12:Envelope>

This example uses a temperature conversion service to convert 75 degrees Fahrenheit to Celsius. Try it out in the example template SOAP: Fahrenheit to Celsius conversion:

Postman SOAP Example

If you’re a genius who can already do this conversion in your head, then check out this collection of other public SOAP APIs to mess around with.

And there you have it! Postman is a trusty tool to handle any API that can utilize HTTP—like REST, SOAP, and GraphQL.

Related: What is an API?

This is an update of a previously published article.

What do you think about this topic? Tell us in a comment below.

Comment

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.

14 thoughts on “Making SOAP Requests with Postman

  • Avatar

    What about WSDL import?

  • Avatar

    What @George Gill said.

  • Avatar

    In my case, the instruction was not correct. Generally example headers, requests and responses are available here: https://www.w3schools.com/xml/tempconvert.asmx?op=CelsiusToFahrenheit but these changes helped me to achieve exepected results: Content-Type header with value “application/soap+xml; charset=utf-8” and the envelope example for SOAP 1.2.

  • Avatar

    Thanks for the Article, helpful !!
    Query: If I have to read all employee records from a WebService API, wondering how the body request looks like. In Rest we dont send any body then, instead we use GET method.
    How is this done in SOAP, any help?

  • Avatar

    Very helpful…Thanks!

  • Avatar

    Postman v8.4.0
    What’s New
    You can now import WSDL specification into Postman

    https://www.postman.com/downloads/release-notes/

  • Avatar

    What about WSS-Signatures to SOAP-Requests? Is there a way to do this with Postman?

  • Avatar

    I Know What You Mean

  • Avatar

    some really prize posts on this web site, saved to fav.

  • Avatar

    I’m getting the error “Server did not recognize the value of HTTP Header” anyone please help us. Please correct me. Thanks in advance.

    My script:

    pm.sendRequest({
    url: “https://XXXXXXXtWS.asmx”,
    method: “POST”,
    header: {
    ‘Content-Type’: ‘text/xml’,
    ‘SOAPAction’: ‘””‘
    },
    body: {
    mode:”raw”,
    raw: “XXXXXXXXXXX ”
    }
    },
    function (err, res) {
    if (res.code === 200) {
    // console.log(“Response – ” + res.text());
    var responseJson = xml2Json(res.text());
    var sessionId = responseJson[‘soapenv:Envelope’][‘soapenv:Body’].loginResponse.result.sessionId;
    console.log(“Session id – ” + sessionId);
    pm.globals.set(“session_id”, sessionId);
    } else {
    console.log(“Response – ” + res.code + ” ” + res.reason());
    console.log(“Response – ” + res.text());
    }
    }
    );

    enter code here

    I’m getting the following error in postman

    soap:ClientServer did not recognize the value of HTTP Header SOAPAction: .

  • Avatar

    Thanks Gerard, that solved my problem, since I had the mesage “Transport level information does not match with SOAP Message namespace URI” when using content-typwe “text/xml”.

  • Avatar

    Hello, Joyce!
    Thank you for developing the Potsman tool, for finding non-standard ways to use it. I wanted to clarify with you about the use of the SOAP protocol. On the page https://blog.postman.com/making-http-soap-requests-with-postman/ you have a resource for getting XML https://www.w3schools.com/xml/tempconvert.asmx. In order for XML to work, does it need to have WSDL installed on this resource? In the standard case, if the SOAP protocol is used, the presence of the WSDL is considered mandatory.

    With best wishes, Artem!

  • Avatar

    How can I set request property like “Expand MTOM Attachments” in Postman?