ASTA in an ISAPI DLL
Since ASTA uses non-blocking and event driven sockets which require windows messaging, using ASTA client components in an ISAPI DLL has been problematic. We have supplied AstaWinManagement.pas in order to add a message pump to an ISAPI DLL, but the results have not been consistent.
We have added some new calls to allow the ASTA client socket to be used in blocking mode. To allow the ASTAClientDataSet to be used, under ASTA 2.5 we have added routines to "cache" dataset calls if the AstaClientSocket.ClientType is ctBlocking. This means that once the AstaClientSocket is set to block you can call normal AstaclientDataSet calls and they will be cached until you say AstaclientSocket1.SendAndBlock(100). Where 100 is a timeout value of how long to wait (see TWinSocketStream for details on this in the Delphi Help).
The following are examples of how to use these new calls.
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
AstaclientDataSet1.OpenWithBlockingSocket(500);
Response.Content := '</HTML> RecordCount is ' +
IntToStr(AstaClientDataSet1.RecordCount) + ' </HTML>';
Handled := True;
end;
procedure TWebModule1.WebModule1WebActionItem2Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
AstaClientSocket1.ClientType := ctBlocking;
//You can now make as many calls as you want and they
// will be cached from the client
AstaClientDataSet1.ExecSQLString('UPDATE Customer SET Company =
' +
QuotedStr(DateTimeToStr(Now)) + ' WHERE CustNo = 1221');
//They will all be sent when you send this
AstaClientSocket1.SendAndBlock(100);
Response.Content := '</HTML> Update Done </HTML>';
Handled := True;
end;