Ozzie.eu

Love to code, although it bugs me.

Posting a SOAP command from the command line on Linux

1 comment
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 \

-X POST

 

1 comment :

Post a Comment