Delphi SOAP Client can not keep more than 2 concurrent requests. How to increase?
Asked Answered
S

2

7

I have a multi-user COM+ application that needs to make multiple requests on SOAP WebServices. Each SOAP request may last from 10 to 60 seconds (that is not under my control). Problem is, I can never make more than 2 requests at the same time.

When I have, for example, 3 concurrent requests the third requests only starts when the second one finishes. I watched the same behaviour on a console application (for testing purposes) making multiple concurrent requests to the same WebService, and I was again limited to 2 requests.

When I tried to consume the same WebServices with another language (C#) the same happened, BUT, on the C# client there is a property that solves the problem:

System.Net.ServicePointManager.DefaultConnectionLimit 

When I increased that property I could keep whatever number of concurrent requests I wanted. Is there a property similar to that one on Delphi?

I'm using the WSDL importer tool to consume the Web Services (Delphi XE2).

Spier answered 24/7, 2014 at 14:23 Comment(1)
Which component are you using that executes the requests? Show some code.Headcloth
N
8

Delphi uses Wininet.dll to make its SOAP requests, IE uses the same DLL. This limitation is in fact documented.

You have 2 choices:

  • adapt the registry like stated in the KB article
  • Use InternetSetOption before the SOAP call:

small code sample (please 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;
Nedanedda answered 24/7, 2014 at 15:32 Comment(0)
H
5

By default, Delphi SOAP programs uses WinInet in Windows, and Indy (TIdHTTP) in other platforms (see USE_INDY directive in SOAPHTTPTrans.pas unit), to comunicate with the server. [1]

You can try using Indy on Windows by defining USE_INDY and recompile the SOAP library (however I have not done this myself so the detailed steps to do this are unknown to me).

p.s. the linked article also indicates that UseNagle should be set to False.

Hindquarter answered 24/7, 2014 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.