Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

Call to BearerToken.ObtainToken() causes an exception

SmartConnector Forum

Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • SmartConnector
  • SmartConnector Forum
  • Call to BearerToken.ObtainToken() causes an exception
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
JeffBowman
Sisko JeffBowman Sisko
164
ardak
ardak Schneider Alumni (Retired)
34
sesa180908_brid
Commander sesa180908_brid Commander
34
mike_meirovitz
Commander mike_meirovitz
21
View All

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Back to SmartConnector Forum
mike_meirovitz
Commander mike_meirovitz
Commander

Posted: ‎2022-04-10 03:35 AM

0 Likes
5
1281
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2022-04-10 03:35 AM

Call to BearerToken.ObtainToken() causes an exception

Hi,

 

We are using a SmartConnector end-point and we call the  BearerToken.ObtainToken() API from our code. See the code below.

When we call this API we see an exception in the SmartConnector log file. See below and attached.

 

public static int ObtainBearerToken ()
{
_bearerToken = null;
try
{
// Obtain Token
Uri uri = new Uri(Settings.m_strURL);
_log.InfoFormat("ObtainBearerToken uri = '{0}', user = '{1}', pass = '{2}'", uri.ToString(), Settings.m_strUser, Settings.m_strPassword);
_bearerToken = BearerToken.ObtainToken(uri, Settings.m_strUser, Settings.m_strPassword, "GetToken");
if (_bearerToken == null)
{
_log.ErrorFormat("ObtainBearerToken fail, token is empty or null");
return -4; // invalid token
}
_log.InfoFormat("ObtainBearerToken pass, token = '{0}'", _bearerToken.ToString());
return 0;
}
catch (Exception ex)
{
_log.ErrorFormat("ObtainBearerToken, Exception, msg = '{0}'", ex.Message);
return -4;
}
}

 

2022-04-10 13:19:19.9006,Debug,EwsConsume,<no principal>,GetWebServiceInformation,c309cc0a-1c53-4f5f-85a0-5c95ad6d8b4b,CommunicationException Handler,{"ClassName":"System.ServiceModel.EndpointNotFoundException","Message":"There was no endpoint listening at https://10.0.0.19/EcoStruxure/DataExchange that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.","Data":null,"InnerException":{"ClassName":"System.Net.WebException","Message":"Unable to connect to the remote server","Data":null,"InnerException":{"NativeErrorCode":10060,"ClassName":"System.Net.Sockets.SocketException","Message":"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\r\n at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nDoConnect\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.Sockets.Socket\nVoid DoConnect(System.Net.EndPoint, System.Net.SocketAddress)","HResult":-2147467259,"Source":"System","WatsonBuckets":null},"HelpURL":null,"StackTraceString":" at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)\r\n at System.Net.HttpWebRequest.GetRequestStream()\r\n at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nGetRequestStream\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.HttpWebRequest\nSystem.IO.Stream GetRequestStream(System.Net.TransportContext ByRef)","HResult":-2146233079,"Source":"System","WatsonBuckets":null},"HelpURL":null,"StackTraceString":" at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n at Ews.Client.IDataExchange.GetWebServiceInformation(GetWebServiceInformationRequest1 request)\r\n at Ews.Client.DataExchangeClient.Ews.Client.IDataExchange.GetWebServiceInformation(GetWebServiceInformationRequest1 request)\r\n at Ews.Client.DataExchangeClient.GetWebServiceInformation(GetWebServiceInformationRequest request)\r\n at Ews.Client.EwsClient.ExecuteAndLogCall[TRequest,TResponse](String methodName, TRequest request, Func`2 methodToLog, Boolean includeMetadata)","RemoteStackTraceString":"\r\nServer stack trace: \r\n at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()\r\n at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)\r\n at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)\r\n at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)\r\n at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)\r\n at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n","RemoteStackIndex":1,"ExceptionMethod":"8\nHandleReturnMessage\nmscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Runtime.Remoting.Proxies.RealProxy\nVoid HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)","HResult":-2146233087,"Source":"mscorlib","WatsonBuckets":null},{"ClassName":"System.Net.WebException","Message":"Unable to connect to the remote server","Data":null,"InnerException":{"NativeErrorCode":10060,"ClassName":"System.Net.Sockets.SocketException","Message":"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond","Data":null,"InnerException":null,"HelpURL":null,"StackTraceString":" at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)\r\n at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nDoConnect\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.Sockets.Socket\nVoid DoConnect(System.Net.EndPoint, System.Net.SocketAddress)","HResult":-2147467259,"Source":"System","WatsonBuckets":null},"HelpURL":null,"StackTraceString":" at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)\r\n at System.Net.HttpWebRequest.GetRequestStream()\r\n at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":"8\nGetRequestStream\nSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\nSystem.Net.HttpWebRequest\nSystem.IO.Stream GetRequestStream(System.Net.TransportContext ByRef)","HResult":-2146233079,"Source":"System","WatsonBuckets":null},,,
2022-04-10 13:19:19.9006,Error,EwsConsume,<no principal>,There was no endpoint listening at https://10.0.0.19/EcoStruxure/DataExchange that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.0.19:443

Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Ews.Client.IDataExchange.GetWebServiceInformation(GetWebServiceInformationRequest1 request)
at Ews.Client.DataExchangeClient.Ews.Client.IDataExchange.GetWebServiceInformation(GetWebServiceInformationRequest1 request)
at Ews.Client.DataExchangeClient.GetWebServiceInformation(GetWebServiceInformationRequest request)
at Ews.Client.EwsClient.ExecuteAndLogCall[TRequest,TResponse](String methodName, TRequest request, Func`2 methodToLog, Boolean includeMetadata)
,["GetWebServiceInformation","c309cc0a-1c53-4f5f-85a0-5c95ad6d8b4b"],
2022-04-10 13:19:19.9006,Debug,Service,<no principal>,ClientPool.CheckOutConnection for http://127.0.0.1:8019/EcoStruxure/DataExchange,
2022-04-10 13:19:19.9006,Error,Processor,<no principal>,There was no endpoint listening at https://10.0.0.19/EcoStruxure/DataExchange that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Unable to connect to the remote server
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.0.19:443

Server stack trace:
at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Ews.Client.IDataExchange.GetWebServiceInformation(GetWebServiceInformationRequest1 request)
at Ews.Client.DataExchangeClient.Ews.Client.IDataExchange.GetWebServiceInformation(GetWebServiceInformationRequest1 request)
at Ews.Client.DataExchangeClient.GetWebServiceInformation(GetWebServiceInformationRequest request)
at Ews.Client.EwsClient.ExecuteAndLogCall[TRequest,TResponse](String methodName, TRequest request, Func`2 methodToLog, Boolean includeMetadata)
at Ews.Client.EwsClient.ExecuteAndLogCall[TRequest,TResponse](String methodName, TRequest request, Func`2 methodToLog)
at Ews.Client.EwsClient.get_EwsVersionImplemented()
at Ews.Client.EwsClient..ctor(EwsSecurity credentials, String address, EwsBindingConfig bindingConfig, Nullable`1 compatibilityVersion)
at Ews.Client.EwsClient..ctor(IEndpoint endpoint, Nullable`1 compatibilityVersion)
at Mongoose.Service.Cache.CachedEwsClient..ctor(String poolKey, IEndpoint endpoint)
at Mongoose.Service.Cache.EwsClientPool.CreateNewInstance(String poolKey, IEndpoint endpoint)
at Mongoose.Service.Cache.ClientPool`3.<>c__DisplayClass5_0.<CheckOutConnection>b__0()
at Mongoose.Service.Cache.ThreadSafeDisposableBase.ThreadSafeCall[T](Func`1 callback)
at Mongoose.Service.Cache.ClientPool`3.CheckOutConnection(TEndpoint endpoint)
at Mongoose.Service.Cache.ManagedEwsClient.ManageCall[T](IEndpoint endpoint, Func`2 method, Nullable`1 callVersion)
at Mongoose.Service.Cache.ManagedEwsClient.GetAlarmEvents(IEndpoint endpoint, Nullable`1 priorityFrom, Nullable`1 priorityTo, String moreDataRef, String[] types, Nullable`1 callVersion)
at Mongoose.Process.Ews.AlarmItemReader.ReadData()
,[],

 

Any idea what causes the exception?

 

Thank you.

 

Mike

 

Attachments
2022-04-10.log
Tags (1)
  • Tags:
  • english
Reply
  • All forum topics
  • Previous Topic
  • Next Topic
Replies 5
ardak
ardak Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2022-04-20 04:00 AM

0 Likes
4
1278
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2022-04-20 04:00 AM

Hi,

 

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.0.0.19:443

 

Is there a EWS enabled EBO server configured to listen to at http://10.0.0.19:443/EcoStruxure/DataExchange?

Tags (1)
  • Tags:
  • english
Reply
mike_meirovitz
Commander mike_meirovitz
Commander

Posted: ‎2022-04-20 12:40 PM

0 Likes
3
1268
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2022-04-20 12:40 PM

Hi,

 

We use HTTP URL not HTTPS. 

Our IP address was changed from 10.0.0.19:8019 to 10.0.0.18:8019. Why does SmartConnector tries to connect to the HTTPS URL instead of HTTP URL?

 

In any case, SmartConnector should not crash...

 

Thank you.

 

Mike

Tags (1)
  • Tags:
  • english
Reply
ardak
ardak Schneider Alumni (Retired)
Schneider Alumni (Retired)

Posted: ‎2022-04-21 12:25 AM

0 Likes
0
1252
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2022-04-21 12:25 AM

Hello,

 

Please restart the service and post screenshots of all your REST endpoint configurations.

 

BR

Armend

Tags (1)
  • Tags:
  • english
Reply
SteveGregory
Commander SteveGregory Commander
Commander

Posted: ‎2022-04-25 11:26 PM

0 Likes
1
1191
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2022-04-25 11:26 PM

Hi Mike,

 

EBO is configured to redirect all HTTP requests to HTTPS by default. You need to uncheck this in the EBO configuration. You may have done this already but it usually catches people out when creating a HTTP endpoint.

Tags (1)
  • Tags:
  • english
Reply
mike_meirovitz
Commander mike_meirovitz
Commander

Posted: ‎2022-04-26 06:39 AM

0 Likes
0
1186
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2022-04-26 06:39 AM

Hi Steve,

 

Thanks. This property is unchecked in the EBO.

 

Mike

Tags (1)
  • Tags:
  • english
Reply
Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

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.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of