You are here

3 January 2016
This article shows how to send a SOAP request from command line. For an example you can test envelopes using curl command on UNIX systems.

Create an envelope

Create a file for the envelope and save it.
Source code viewer
  1. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:my:service:types">
  2. <soapenv:Header/>
  3. <soapenv:Body>
  4. <urn:Message>
  5. <urn:Element_1>Value 1</urn:Element_1>
  6. <urn:Element_2>Value 2</urn:Element_2>
  7. </urn:Message>
  8. </soapenv:Body>
  9. </soapenv:Envelope>
Programming Language: XML
Send the request using curl.
Source code viewer
  1. curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:ACTION_YOU_WANT_TO_CALL" --data @FILE_NAME URL_OF_THE_SERVICE
  2.  
  3. # For an example:
  4. curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:urn:my:service-interaction:soap:some-action" --data @envelope.txt http://127.0.0.1:8080/myservice
Programming Language: Bash