Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Enterprise – Business applications platform > Asynchronous GET to resource o timeout

Forum

Search UsersRules
Asynchronous GET to resource o timeout
#1
Interested
Points:: 15
Joined:: Oct 27, 2011

I have some GET calls to web-service. I do not use any of WSDL services, just HTTP connection object. Sometimes the server is down or there is no connection. 1c hangs up until gets any response from server / HTTP handler. This could take forever.
So I want to implement asynchronous call to remote resource o kill connection by timeout.

What is the best way to do it?

Profile
#2
Guest
Points::
Joined::

Hello, Alexey!

Try Timeout property of HTTPConnection object.

Profile
#3
Interested
Points:: 15
Joined:: Oct 27, 2011

Timofey, your method fails. It actually force the system to terminate (crashes platform).
Have tried on 8.2.17 8.3.4.408,447
The code is as follows:

Code
   // set connection with server
   Try
         Connection = New HTTPConnection(ServerAddress,,,,10,True);
   Except
       Message("Couldn't connect to online verification server:" 
             + Chars.LF + ErrorInfo().Description, MessageStatus.Important);
       Return ErrorInfo();
   EndTry;


While the error will be under investigation and correction, please give me some alternative. I have promised to my client that i'll make it work, but I can't leave it without timeout because it has very unstable connection and the whole program is hanging while there is no internet.

Without timeout the code works on every version of the platform. The code is server-side.

Profile
#4
Guest
Points::
Joined::

Try using javascript ajax requests in HTMLDocument field.

Profile
#5
Guest
Points::
Joined::

Hello, Alexey.
You have misplaced Timeout in parameters. It should be 6th, not 5th.
And 7th parameter type is not Boolean, so if you do not need a secure connection, assign Undefined there.

Code
Connection = New HTTPConnection(Host, Port, User, Password, Proxy, Timeout, SecureConnection);

Here is an example for you.

Profile
Subscribe
Users browsing this topic (guests: 2, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.