Skip to content

Instantly share code, notes, and snippets.

@hendisantika
Forked from gustavohenrique/soap-curl-shell
Created May 10, 2017 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hendisantika/3bc4ee33a35b929dd6eea3f74aebf3c2 to your computer and use it in GitHub Desktop.
Save hendisantika/3bc4ee33a35b929dd6eea3f74aebf3c2 to your computer and use it in GitHub Desktop.
SOAP request using curl
# request.xml
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wst="http://sensedia.com/repository/wstoolkit">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>system</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">manager</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">DWk64SMfJ6RxHAKgPRGtPA==</wsse:Nonce>
<wsu:Created>2013-04-17T18:36:54.013Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<wst:search>
<in>
<keywords>python</keywords>
<restrictions>
<sortBy>DATE</sortBy>
</in>
</wst:search>
</soapenv:Body>
</soapenv:Envelope>
# makerequest.sh
ACTION="wst:search"
URL="http://mydomain.com.br/services/queryPort"
curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:$ACTION" -d@request.xml $URL > output.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment