Hellow there folks! These days most of the web services are exposed as REST or 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 curl it can transfer data using various protocols. If you don’t have curl installed use the below command.

 

SOAP Request Flow

SOAP request

Image Courtesy : java-forums.org

Step 1

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.

 

Step 2

Let’s make a request using the curl command.

 

Below mentioned should be replaced according to your web service.

  1. ACTION_YOU_WANT_TO_CALL
  2. FILE_NAME
  3. URL_OF_THE_SOAP_WEB_SERVICE_ENDPOINT

See the example below to get an idea.

See the sample O/P below. You should get a similar O/P according to your web service.

Example O/P

 

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).

Be Sociable, Share!