The 1C:Enterprise developers forum

#1
People who like this: 0 Yes / 0 No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

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?

 
#2
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

Hello, Alexey!

Try Timeout property of HTTPConnection object.

 
#3
People who like this: 0 Yes / 0 No
Interested
Rating: 32
Joined: Oct 27, 2011
Company: Abaco Soluciones S.A.

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.

 
#4
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

Try using javascript ajax requests in HTMLDocument field.

 
#5
People who like this: 0 Yes / 0 No
Timofey Bugaevsky
Guest

Joined:
Company:

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.

Edited: Timofey Bugaevsky - Mar 31, 2014 05:27 AM
 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)