- 04 Feb 2024
- 2 Minutes to read
- Print
- DarkLight
Creating SOAP API Test in Automate
- Updated on 04 Feb 2024
- 2 Minutes to read
- Print
- DarkLight
SOAP (Simple Object Access Protocol) is a messaging protocol that allows two applications to communicate with each other over a network using XML messages.
In pCloudy, you can create test cases for both SOAP and REST APIs. To ensure reusability in such test cases, Opkey provides service repositories that can store methods for testing APIs and can be reused across test cases.
In the following sections, we will understand the process of creating a SOAP API test case. Here, we will use the example of a SOAP service that converts Celsius to Fahrenheit.
Hover over the Automate section and click the API Test category.
Now, click the Create API Test button to open the Create ApiTest window.
In this window, add a name, select priority, choose an assignee, and add a description. Once done, click the Create button at the bottom.
Now, you will get an option to choose the service type. Select the SOAP service button as shown below.
Enter a valid URL in the API Endpoint text box. For example - we are using the URL
https://www.w3schools.com/xml/tempconvert.asmx?op=FahrenheitToCelsius
You may also need to provide authentication details (from the Authentication type dropdown) if it’s required by the SOAP web service.
Note: SSL (Secure Sockets Layer) ensures secure, encrypted communication between a website and a web browser. However, some websites may lack SSL or TLS security certificates.
When using the Service Repository in Opkey One for such sites, you can bypass SSL/TLS errors by going to the settings tab and disabling the "Ignore SSL/TLS Error" option. This will disregard all SSL/TLS-related errors.
Now, you need to add a new method to the added Soap service. Click on the Add Method icon on the left as shown below.
Go to the XML Parameter tab and click on Add From XML icon.
A new popup window will open to add XML data.
Now go to the URL
https://www.w3schools.com/xml/tempconvert.asmx?op=FahrenheitToCelsius
and copy the requested XML data.
Paste the copied XML in the Add from XML window and click the Save button.
Added Soap XML gets broken down into input parameters. You can edit input parameter values as required. Click on the Save button to save the entered values.
Now, you can go to the Header Parameter tab if you want to add the required header parameters. Click the + icon to add a new parameter with input arguments and description. Make sure to check the IsArgument checkbox.
Note: Adding new Input Parameters and providing names, values, etc. depends on the SOAP Web Service. In our SOAP service example, headers are not required.
After this, you can click the Save button at the top-right corner to save your SOAP Service Repository file.
Now, let’s test the SOAP API service we have created. Go to the XML parameter tab and provide a default value in the last row. Make sure that the last row is checked. After adding the value, click the Send button. Here, we have added 20 as the default value.
After clicking the Send button, you will receive a response under the Request Data tab. The response contains a Status shown as “200 OK” which means that the API call was successful. You can also see the Fahrenheit value 20 converted to Celsius value -6.66666666666667.
You've reached the end of this article and are now well-prepared to create SOAP API tests.