Reputation: 238
I am using Exchange web services for sync. of my calendars and events. I wasted my lots of time for finding solution of this error. Can any one please help me.
SOAP client returned status of 401
Upvotes: 2
Views: 3714
Reputation: 1
After setting the security feature 'extended protection for exchange' i had the same problem (SOAP 401). Now i have to use CURLAUTH_BASIC instead of CURLAUTH_NTLM.
Upvotes: 0
Reputation: 2610
Current status for anyone arriving from Google:
Username and password authentication has been removed as per October 2022 for exchange servers on 365.
So you will have to change authentication to oauth or use a different library.
There is a comment about it on this issue: https://github.com/jamesiarmes/php-ews/issues/212#issuecomment-1275400001
Upvotes: 2
Reputation: 105
I got a 401 response for every SOAP Request and also struggled to find out why.
Running Ubuntu, curl version: 7.35.0.
As pointed out here "CURLAUTH_BASIC" should be removed in NTLMSoapClient.php from line:
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC | CURLAUTH_NTLM);
so that it only says
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
This works for me for jamesiarmes/php-ews project.
In garethp/php-ews though, (which seems to offer quite a lot of convenience methods for querying the exchange server), setting the curl authentication method moved to src/API/ExchangeWebServicesAuth.php.
EDIT: See curl docs for more info on authentication methods.
Upvotes: 1