Technical Articles
Calling a SOAP API using Postman
This blog post will deal mainly with the issue of how you can call a SOAP API using some widely used software. The software I’m using is a state-of-the-art tool, especially for RESTful APIs, which goes by the name of Postman.
Recently, Postman published a new version, which allows us to also use the WSDL file: Blog Post
In this blog post, though, I will show you in some easy steps how you can test your SOAP API without using the WSDL file.
Now, before we go into the details, you might ask yourself why to use Postman in the first place as we have the popular SoapUI tool. The problem here is that the open source version is collecting data, and therefore, this could not be compliant with your company’s regulation. The pro version does not do that, but here you have to buy the license, obviously.
So, Postman is compliant with probably all companies out there.
Login to your cloud system using your administrator account, which has the right authorization for the Communication Arrangement app. Open the application and search for your communication scenario that is using a SOAP API. In this case, as an example, we will use SAP_COM_0316 which is the communication scenario for posting bank statements via the SOAP API. Then, copy the service URL as shown in the screenshot.
Open Postman and create a new collection by clicking on New.
Create a new request, give it a name and save it in a new folder.
Then, paste the service URL from the Communication Arrangement app into the URL input field. Select the right request type – in this example, we POST something to the cloud system.
Select the Authorization tab, choose the authorization type that is needed for your SOAP API communication – in this example, it’s Basic Auth. Enter your credentials for your cloud system.
Select the Headers tab and add the Content-Type key with the text/xml value.
Click on the Body tab, select raw and XML and enter your SOAP message in the input field.
That’s pretty much it. Afterwards, you should see if your request was successful (hopefully you received a 200 HTTP response).
In case you need further information on how the SOAP API for bank statement processing looks like, feel free to have a look at our help portal.
Best,
Edrilan Berisha
SAP S/4HANA Cloud Development Financials
Thx for sharing! Good to know...
Thank you for Sharing.
For me it was only working if I set the Header
regards
Gunter
This depends on your payload. The difference between your Content-Type and mine is:
"If an XML document -- that is, the unprocessed, source XML document -- is readable by casual users, text/xml is preferable to application/xml. MIME user agents (and web user agents) that do not have explicit support for text/xml will treat it as text/plain, for example, by displaying the XML MIME entity as plain text. Application/xml is preferable when the XML MIME entity is unreadable by casual users"
Best,
Edrilan
Hey Edrilan Berisha ,
Nice blog post, I have some problems, do you mind if you can help me?
I create a wsdl service for a function group. When I try it in postman, it returns 403 Forbidden. I've already entered basic authentication(username, passwd).
I also try application/soap+xml, text/xml, application/xml as Content-Type.
What's the issue, I can't solve.
Relevant screenshots are below.
Hi Sadullah TANRIKULU,
I cannot help you on this one here. I simply do not know anything about how you set up your SOAP endpoint. All I can say is, that this URL looks strange to me, the header in your request should contain most likely also an authorization part. If you use basic authorization you should see in the header a greyed out Key = Authorization, Value = Basic xSddkalskblabla
Without knowing what you have done, no one can help you here. I would rather propose to open a new question thread in the Q&A section, where you explain step by step what you do and how your endpoints looks like.
Best,
Edrilan Berisha
SAP S/4HANA Cloud Financials Development