I have a problem with SOAP WebServer: if I have a method on the server that takes a few seconds to give a result, and I cannot make more than two calls "simoultaneously" (called from threads) from my client application (developed in Delphi. Also - for testing only, the final client application will be based on the Internet). I mean, the streams are somehow serialized, and I don’t know if this should happen this way, or if I am doing something wrong or I need to make a certain setting.
Delphi XE2 Professional, Windows 7 64-bit
Link to my archived project: http://1drv.ms/Nwu9nY
Server Method:
function TServiciu.Test: string;
var t0, t1, Duration : Cardinal;
Guid : tguid;
RGuid : HRESULT;
received : boolean;
const MaxTime : Cardinal = 3000;
begin
Result := '';
RGuid := CreateGuid(Guid);
if RGuid = S_OK then
Result := GuidToString(Guid);
t0 := GetTickCount;
t1 := GetTickCount;
duration := t1 - t0;
while (Duration < Maxtime) do begin
//waiting for something to be written in a db by another program
//I am doing querys to the database for that result
if received then begin
Result := Result + '_RECEIVED_' + DateTimeToStr(Now);
Break;
end;
t1 := GetTickCount;
duration := t1 - t0;
if duration > Maxtime then begin //MaxTime allowed is exceded
Result := Result + '_NOTRECEIVED_' + DateTimeToStr(Now);
Break;
end;
end;
end;
:
procedure TThreadTest.Execute;
begin
try
OleCheck(CoInitializeEx(NIL, COINIT_MULTITHREADED or COINIT_SPEED_OVER_MEMORY));
try
s := 'Calling Method Test; Result=' +
Self.ThGetService.Test;
Synchronize(self.ScrieRezultat);
finally
CoUninitialize;
FreeAndNil(self.ThHttprio);
end;
except
end;
end;