The Delphi SOAP client cannot store more than two simultaneous requests. How to increase?

I have a multi-user COM + application that needs to complete several requests in SOAP WebServices. Each SOAP request can last from 10 to 60 seconds (this is not under my control). The problem is that I can never make more than two queries at the same time.

If I have, for example, 3 simultaneous requests, then the third request starts only after the second is completed. I observed the same behavior in a console application (for testing purposes) making multiple concurrent requests for the same WebService, and again I was limited to two requests.

When I tried to use the same Web services with a different language (C #), then this happened, BUT, on a C # computer there is a property that solves the problem:

System.Net.ServicePointManager.DefaultConnectionLimit 

When I increased this property, I was able to save any number of concurrent requests that I wanted. Is there a property similar to what is on Delphi?

I am using a WSDL importer tool to use web services (Delphi XE2).

+7
soap web-services delphi delphi-xe2 com +
source share
2 answers

Delphi uses Wininet.dll to execute its SOAP requests, IE uses the same DLL. This restriction is actually documented .

You have 2 options:

  • adapt the registry as indicated in KB article
  • Before calling SOAP, use InternetSetOption :

A small code example (note that it does not include error checking):

 Const INTERNET_OPTION_MAX_CONNS_PER_SERVER = 73; INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER = 74; var MaxConnections : Integer; begin MaxConnections := 10; // adapt to your needs InternetSetOption(Nil, INTERNET_OPTION_MAX_CONNS_PER_SERVER, @MaxConnections , SizeOf(MaxConnections )); InternetSetOption(Nil, INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER, @MaxConnections , SizeOf(MaxConnections )); // do SOAP call end; 
+8
source share

By default, Delphi SOAP programs use WinInet on Windows and Indy (TIdHTTP) on other platforms (see the USE_INDY directive in SOAPHTTPTrans.pas) to contact the server. [one]

You can try using Indy on Windows by specifying USE_INDY and recompiling the SOAP library (however, I didn’t do this myself, so I don’t know the detailed steps for this).

The ps related article also indicates that UseNagle should be set to False.

+5
source share

All Articles