Hellow there folks! These days most of the web services are exposed as RESTor SOAP. There could be a chance where you need to make a request from your command line rather than installing a tool such SOAPUI. Tools are really helpful but there are times where you can’t use tools. I’ll be using curl to make the request. if you don’t know about curlit can transfer data using various protocols. If you don’t have curl installed use the below command.
sudo apt-get install curl
Let’s create a SOAP envelope as below which is the SOAP request to be sent via curl. Create a file with the below content named “request.xml”. The SOAP envelope and the SOAP request parameters depend on your web service.
Let’s make a request using the curl command.
curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction: ACTION_YOU_WANT_TO_CALL" --data @FILE_NAME URL_OF_THE_SOAP_WEB_SERVICE_ENDPOINT
Below mentioned should be replaced according to your web service.
See the example below to get an idea.
curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:urn:GetVehicleLimitedInfo" --data @request.xml http://18.104.22.168:9080/VehicleInfoQueryService.asmx
See the sample O/P below. You should get a similar O/P according to your web service.
1411050004 200 GP-XXYY 4G13-YX59ZC MOTOR CAR MITSUBISHI LANCER 1999 0
Hope you got an idea how to make a request SOAP request using command line. If you have any questions let me know in the comments below. Your feedback is highly appreciated(happy-face).