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

Processor development information request with API call

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
  • Processor development information request with API call
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
Solved Go to Solution
Back to SmartConnector Forum
Solved
Sabrina_Merelli
Lieutenant Sabrina_Merelli Lieutenant
Lieutenant

Posted: ‎2021-10-26 07:41 AM

0 Likes
5
1750
  • 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.

‎2021-10-26 07:41 AM

Processor development information request with API call

Dear Community,

 

I am developing a processor which makes an API call to download data from a third party system.
I make the call with an HttpClient object

 

 

Spoiler

// Creation

httpClient.DefaultRequestHeaders.Accept.Clear();

httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

 

// Basic authorization

var byteArray = Encoding.ASCII.GetBytes(UsernameStarRezAPI + ":" + PasswordStarRezAPI);

httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));

 

// Download call

Task<HttpResponseMessage> t = httpClient.PostAsync(URLStarRezAPI + "/query", byteContent);

t.Wait(new TimeSpan(0,0,30));

HttpResponseMessage response = t.Result;

 

The call data (url, authentication, data format) are correct, because if I use it from a client such as ARC and I have no problems.
If I make the call with the processor in debug, the call is made correctly and the requested data is returned.

 

If I load the processor into the SmartConnector, compiling it in release, the Wait call goes into exception:

 

2021-10-25 11:46:45.9328,[SEStarRezProcessor] DownloadReservationFromStarRezAPI Si sono verificati uno o più errori.

   in System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)

   in System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)

   in System.Threading.Tasks.Task.Wait(TimeSpan timeout)

   in EsxSEStarRezProcessor.SetupProcessor.<DownloadReservationFromStarRezAPIAsync>d__35.MoveNext(),

 

Can you help me to understand what can be the cause? 

The API is in https, I don't know if there are any limitations on this.

 

 

Thanks for your availability and support,

Sabrina

Tags (1)
  • Tags:
  • english
Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
Sabrina_Merelli
Lieutenant Sabrina_Merelli Lieutenant
Lieutenant

Posted: ‎2021-11-09 07:52 AM

1 Like
1
1711
  • 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.

‎2021-11-09 07:52 AM

Dear Colleagues,

we solved, and here's the solution, in case someone has the same problem:

 

Sniffing the API calls made we saw that the problem was that the StarRez server requires the use of Tls1.2 for https calls, while the Smart Connector makes those calls using Tls1 by default (unless otherwise specified) .

For some reason when we run it in debug the calls are made by default with the correct Tls protocol so the problem was not detected.

We forced the correct version into the call and fixed the problem.

 

Sabrina

See Answer In Context

Tags (1)
  • Tags:
  • english
Reply
Replies 5
Erwin-vd-Zwart
Sisko Erwin-vd-Zwart Sisko
Sisko

Posted: ‎2021-10-26 07:57 AM . Last Modified: ‎2021-10-26 08:06 AM

0 Likes
2
1746
  • 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.

‎2021-10-26 07:57 AM

Hi Sabrina,

 

I assume you are on the corperate network, i expirenced the same with HTTP(S) requests working in the debug but not in the framework, what you need to do is change the service log on from local system account to this account and use your SESA credentials. Keep in mind to change it when you change your SE login every 6 months. See attachment for the settings

 

 

Attachments
Tags (1)
  • Tags:
  • english
Reply
Sabrina_Merelli
Lieutenant Sabrina_Merelli Lieutenant
Lieutenant

Posted: ‎2021-10-27 02:23 AM

0 Likes
1
1733
  • 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.

‎2021-10-27 02:23 AM

Hi Erwin,

thank you for your suggestion,

We changed the log on of the service but unfortunately it didn't solve the problem.

 

Any other ideas?

 

It can be the basic authentication the problem?

 

Thanks again

 

Sabrina 

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

Posted: ‎2021-10-28 12:05 AM

0 Likes
0
1726
  • 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.

‎2021-10-28 12:05 AM

Hi Sabrina,

 

The stack trace you get is very generic, I'd try to catch the exception(just wrap your code in a try-catch) and log as much as you can. How long does the processor run before erroring out?

 

BR

Armend

Tags (1)
  • Tags:
  • english
Reply
Sabrina_Merelli
Lieutenant Sabrina_Merelli Lieutenant
Lieutenant

Posted: ‎2021-11-09 07:52 AM

1 Like
1
1712
  • 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.

‎2021-11-09 07:52 AM

Dear Colleagues,

we solved, and here's the solution, in case someone has the same problem:

 

Sniffing the API calls made we saw that the problem was that the StarRez server requires the use of Tls1.2 for https calls, while the Smart Connector makes those calls using Tls1 by default (unless otherwise specified) .

For some reason when we run it in debug the calls are made by default with the correct Tls protocol so the problem was not detected.

We forced the correct version into the call and fixed the problem.

 

Sabrina

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

Posted: ‎2021-11-09 08:08 AM

0 Likes
0
1708
  • 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.

‎2021-11-09 08:08 AM

Good catch!

 

Smartconnector is TLS "agnostic" and will let the OS decide what protocol to use.

 

There's a lot of good info here, including how to "prefer" TLS 1.2 system wide instead of in code.

https://docs.microsoft.com/en-us/dotnet/framework/network-programming/tls

 

Not sure why it would be different while debugging and in the service in your case though, if you have any hints please let me know 🙂

 

BR

Armend

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