Many people finds difficult to test SOAP services before they can implements into there respective projects or apps. So in this post we will learn how to test SOAP requests.
Before we get started, we must know about SOAP and Postman.
What is SOAP?
SOAP (Simple Object Access Protocol) is an application communication protocol for sending and receiving messages. It’s based on XML and is platform independent.
What is Postman?
Postman is a powerful HTTP client for testing web services. Visit the download page to get latest version.
Now lets talk about the actual problem, the following is the sample SOAP Request:
POST /codapi/Service1.asmx HTTP/1.1 Host: webapp.tcscourier.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://126.96.36.199:6265/GetAllCountries" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetAllCountries xmlns="http://188.8.131.52:6265/" /> </soap:Body> </soap:Envelope>
First step is to open Postman client window and then click “NEW” at top left most window position, followed by “Request” (Create a basic request) button.
Now name the request and save into the collection.
Change request method to POST, and enter url (combining Host and POST) data from the request part:
Then browse to “raw” section under “Body” tab, Copy and paste XML soap request into the editor and select content type as XML (text/xml).
Now hit send, you will see the output as XML format.
That’s it, this is the response we are actually expecting.
This SOAP request can be executed/run by PHP as well, in future we will see how to request SOAP service by using PHP.