The Postman application and the SAP API hub itself are great tools for testing APIs, especially OData APIs, there is often confusion and frustration on how to properly test SOAP based APIs. Forming XML payloads for SOAP calls can be tedious for Postman. SoapUI is a great application to quickly test SOAP based APIs in SAP S/4HANA Cloud (SAP S/4HC) that does a lot of the heavy lifting for you. The software also has a REST client for testing OData APIs and has free and professional versions that can be downloaded here: https://www.soapui.org/downloads/soapui.html
This blog will use the free version of SoapUI. After you download and install the software, you are ready to test APIs in S/4HC from your client. In this example, we’ll use the synchronous Journal Entry API post a Journal Entry. We’ve already setup the API in our S/4HC system by creating the communication user, system and finally the communication arrangement SAP_COM_0002.
Here are the steps to test the API using SoapUI.
- Download the WSDL from the communication arrangement
Select File-> New SOAP Project
Provide a project name, and select the WSDL downloaded from the Communication Arrangement. Also, check the box for “Creates a TestSuite for the imported WSDL”
Click OK to accept the defaults on the next screen
Now, if you expand the Test Suite and double click on the Journal EntryCreateRequestConfirmation under Test Steps you can find a sample file ready to test with fields marked as mandatory or optional
At the bottom of the test script are some test configuration options. The first thing you should do is configure the authentication. Click on the Auth tab and select Add New Authorization…
Add a Basic authorization type
Add the communication user and password that are associated to the communication arrangement from which you downloaded the wsdl in step 1.
There are other options on WS-A and WS-RM tab that sometimes you may need to set such as randomly setting a message ID but for the journal entry API we are all set.
Now, you can form your message payload according to the API documentation and the values that you want to use. Note that you need to remove the fields with the ? in them–either place values into them or simply take them out.
When you are ready to test, press the play icon in the upper left to submit the message to the server.
Since we are testing a synchronous SOAP service, we immediately see the message reply in the right hand pane of SoapUI test suite and can see that the message was successful.
I hope you found this blog helpful.