Posting a SOAP command from the command line on Linux

Having to work with servers, which connect to external systems via private networks, one must face the difficulty of having to test Web services without having direct access to the endpoint of them. Given that, and adding the Linux operating system, one could find himself in a jam.

There is a command I use often to perform simple connectivity tests, like getting the WSDL. It’s called “wget”. You just type “wget http://someurl/endpoint” and an HTTP request to that URL is sent and the response is captured ans saved to file.

Nevertheless, one might be able to connect to the remote server, but what id you want to check if the service is really working? Otherwise you’ll never know if an error is caused by your end of the stick.

To post a SOAP request to a remote Web server, the recipe is simple:

  1. Build a sample SOAP request and save it on a text file, maybe called “soap.txt”
  2. To send the request to the remote server type the following command:


curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction:" \
-d @soap.txt -X POST http://someurl

That’s it! 

curl -H “Content-Type: text/xml; charset=utf-8” \
-H “SOAPAction:” \
-d @pedidoSOAP.txt \



1 thought on “Posting a SOAP command from the command line on Linux

  1. Pingback: Posting SOAP request from Windows Powershell | Rambles on Technology

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s