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="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:hel="http://schemas.datacontract.org/2004/07/Helpline.Activities.IncidentRecordScope"
                   xmlns:tem="http://tempuri.org/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
        <tem:StartIncidentByWS>
            <tem:ctx/>
            <tem:data>
                <hel:strSubject>TEST</hel:strSubject>
            </tem:data>
        </tem:StartIncidentByWS>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

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.

Dear Devs: You can help Ukraine🇺🇦. I opted for (a) this message and (b) a geo targeted message to Russians coming to this page. If you have a blog, you could do something similar, or you can link to a donations page. If you don't have one, you could think about launching a page with uncensored news and spread it on Russian forums or even Google Review. Or hack some russian servers. Get creative. #StandWithUkraine 🇺🇦
Dear russians🇷🇺. I am a peace loving person from Switzerland🇨🇭. It is without a doubt in my mind, that your president, Vladimir Putin, has started a war that causes death and suffering for Ukrainians🇺🇦 and Russians🇷🇺. Your media is full of lies. Lies about the casualties, about the intentions, about the "Nazi Regime" in Ukraine. Please help to mobilize your people against your leader. I know it's dangerous for you, but it must be done!