How to call a SOAP webservice with cURL and NTLM authentication?

September 2021

Here’s an example for a soap call with curl and ntlm authentication:

curl --ntlm --user "domain\user:pw"  --location --request POST 'YOUR_ENDPOINT' \
--header 'SOAPAction: YOUR_SOAP_ACTION' \
--header 'Content-Type: text/xml; charset=utf-8' \
--data-raw 'YOUR_BODY'

Some notes:

<SOAP-ENV:Envelope xmlns:SOAP-ENV=""

Some notes: - If you get the error curl: (92) HTTP/2 stream 0 was not closed cleanly: HTTP_1_1_REQUIRED (err 13), add the --http1.1 flag. Reason: Not all servers are configured properly to work with http 2. - Add the --verbose flag to get a more detailed output of what’s happening. - You’ll need to enter domain + username + pw exactly like this: domain \ user : pw, so backslash between domain and user and colon between user and pw.

Become a better web developer by staying up to date