Making SOAP Requests with Postman
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
Related: Check out the Salesforce SOAP API
If so, here’s how you can use Postman for making SOAP requests:
- Enter the SOAP endpoint as the request URL in Postman:
https://www.w3schools.com/xml/tempconvert.asmx
- Set the request method to
POST
. - Under the Body tab, set the body type to
raw
and selectXML
from the dropdown. Once you add XML data as the body, Postman will automatically add aContent-Type
header that can be seen under the Headers tab. While REST typically uses JSON and other data formats, SOAP relies on XML. - Under the Headers tab, add a new header where
Content-Type
is the key andtext/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 differentContent-Type
header. You can deselect the originally added header. - 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:
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 about WSDL import?
What @George Gill said.
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.
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?
Very helpful…Thanks!
Postman v8.4.0
What’s New
You can now import WSDL specification into Postman
https://www.postman.com/downloads/release-notes/
What about WSS-Signatures to SOAP-Requests? Is there a way to do this with Postman?
I Know What You Mean
some really prize posts on this web site, saved to fav.
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: .
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”.
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!
How can I set request property like “Expand MTOM Attachments” in Postman?
Please contact our support team at http://www.postman.com/support, and they’ll be able to help you.