SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Link copied. Please paste this link to share this article on your social media post.
I tried to create EwsClient with the following two ways and got the same exception: "The HTTP request is unauthorized with client authentication scheme 'Digest'. The authentication header received from the server was 'Digest realm="ews@SxWBM",qop="auth",nonce="827DD2915ED2AF6BC10A82600FE90014",opaque="6CA079"'."
EwsClientAddress = http://localhost:8081/EcoStruxure/DataExchange;
1.
var client = MongooseObjectFactory.Current.GetInstance<IManagedEwsClient>();
var endpoint = new EwsConnection
{
EwsEndpoint = EwsClientAddress,
UserName = SBOConnectionSetting.UserName,
Password = SBOConnectionSetting.Password
};
var resp = client.GetWebServiceInformation(endpoint);
2.
EwsServerDataAdapter.ConnectExisting(EwsServer.Name, EwsServer.UserName, EwsServer.Password);
EwsSecurity ClientSecurity = new EwsSecurity
{
UserName = SBOConnectionSetting.UserName,
Password = SBOConnectionSetting.Password
};
var clientObj = new EwsClient(ClientSecurity, EwsClientAddress);
It seems that in SmartConnector V2.2.108, the AuthenticationScheme in EwsSecurity is removed.
What should I do to prevent this exception happening?
Thanks!
Juh
Link copied. Please paste this link to share this article on your social media post.
Hi,
I have found out the problem. The wrong password caused the exception.
Thanks!
Juh
Link copied. Please paste this link to share this article on your social media post.
Juh,
I know you discovered the issue on your own, but I wanted to add a couple of comments.
var creds = new EwsConnection
{
EwsEndpoint = ServerAddress,
UserName = user.UserName,
Password = password
};
var client = MongooseObjectFactory.Current.GetInstance<IManagedEwsClient>();
client.GetWebServiceInformation(creds);
Whether you use EwsClient or IManagedEwsClient is largely one of personal preference however if you frequently instantiate and dispose of your connection, the IManagedEwsClient would be the preferred approach
Link copied. Please paste this link to share this article on your social media post.
Thank you, Mark.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.