This is an old revision of the document!
From: Stig Johansen (stig.johansen@udvikling.it) Subject: Re: Cannot run two SOAP-threads ? Newsgroups: borland.public.kylix.internet.web Date: 2002-05-06 21:01:50 PST
Jochen Staerk wrote:
i've got a problem that my kylix raises several errors up to sigservs
when i try to run two or more threads that create themselves httprios
and query a web service. the same code runs with windows!
I had the some problems using soap clients in multithreaded environments. I have a working solution, allthough I am not sure whether it is the right solution:
the declaration to threadvar instead of var.
request is ok, the second inserts extra crlf in the header, the third crashes. I dont have the time to debug indy, so I replaced it with Synapse. See:
From my previous post:
I downloaded the latest source, and made the following changes in SOAPHTTPTrans:
Added:
procedure SetupSyna(SynaHttp: THTTPSend); var ContentHeader, ActionHeader: string; Protocol, Host, path, Document, Port, Bookmark: string; begin if (soNoValueForEmptySOAPAction in FInvokeOptions) and (SoapAction = '') then ActionHeader := SHTTPSoapAction + ':' else if SoapAction = '""' then ActionHeader := SHTTPSoapAction + ': ""' else ActionHeader := SHTTPSoapAction + ': ' + '"' + FSoapAction + '"'; SynaHttp.Headers.Add(ActionHeader); SynaHTTP.MimeType := 'text/xml'; { do not localize } SynaHttp.Protocol := '1.0' ; end; {$IFDEF USE_SYNA} procedure PostData(Response: TStream); var SynaHTTP: THTTPSend; WireData: string; begin SynaHTTP := THTTPSend.Create; try SetupSyna(SynaHttp); WireData := UTF8Encode(DataMsg); SynaHTTP.Document.Write(Pointer(WireData)^, Length(WireData)); try SynaHTTP.HTTPMethod('POST', FURL); Response.CopyFrom(SynaHTTP.Document, 0); finally end; finally FreeAndNil(SynaHTTP); end; end; {$ENDIF} And the following change: {$IFDEF USE_INDY} InitURL(FURL); {$ENDIF}