Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread Can the EWB 3 Server be deployed as an ISAPI DLL
Thu, Nov 26 2020 5:04 PMPermanent Link

Walter Matte

Tactical Business Corporation

The web apps I have created with EWB (2) are almost excusively deployed in to existing customers running IIS servers.The have their own certs.  the are using https and have other content and apps running on the IIS server.  It is robust and scalable.

I deploy ISAPI dll to accomplish this.  My DLL handles all the Dataset requests emitted by EWB apps - which has been the most important feature to me.

Will EWB 3 have an ISAPI Server option - or - can I still write my own DLL and still use EWB 3 (probably not using many of the new framework or server side stuff.) Quite frankly I don't need the serve side modules.  I am unhindered in what I do now in my ISAPI DLL server.  

Walter
Mon, Dec 21 2020 1:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Walter,

Sorry for the late reply.

<< Will EWB 3 have an ISAPI Server option - or - can I still write my own DLL and still use EWB 3 (probably not using many of the new framework or server side stuff.) Quite frankly I don't need the serve side modules.  I am unhindered in what I do now in my ISAPI DLL server. >>

Yes, you can still do your own thing using the TEWBDatabaseAdapter and TEWBDataSetAdapter components (although you probably won't need the TEWBDatabaseAdapter component anymore.  You'll just need to handle the methods for returning/consuming the JSON manually like you are now.

However, the dataset components have changed a bit to accommodate the new REST-ful structure to the database API.  Here is the underlying TEWBDatabaseAdapter code for handling a request - you should use it as the template for modifying anything on your end from EWB 2.x:

procedure TEWBDatabaseAdapter.HandleRequest(Request: TEWBServerRequest;
                                           const DatabaseName: String='');
var
  TempDataSetName: String;
  TempEntityName: String;
  TempName: String;
  TempDataSetAdapter: TEWBDataSetAdapter;
  TempColumnName: String;
  TempContent: AnsiString;
  TempContentType: String;
begin
  with Request do
     begin
     if CheckMethod([rmGet,rmPost]) then
        begin
        if (DatabaseName <> '') then
           begin
           if (RequestPathComponents.Count >= 3) and
              SameText(RequestPathComponents.Components[2],DatabaseName,loUserLocale) then
              begin
              if (RequestPathComponents.Count >= 4) then
                 begin
                 TempDataSetName:=RequestPathComponents.Components[3];
                 if (RequestPathComponents.Count >= 5) then
                    TempEntityName:=RequestPathComponents.Components[4]
                 else
                    TempEntityName:=''
                 end
              else
                 begin
                 TempDataSetName:='';
                 TempEntityName:='';
                 end;
              end
           else
              begin
              SendError(HTTP_NOT_FOUND,'Resource not found');
              Exit;
              end;
           end
        else
           begin
           if (RequestPathComponents.Count >= 3) then
              begin
              TempDataSetName:=RequestPathComponents.Components[2];
              if (RequestPathComponents.Count >= 4) then
                 TempEntityName:=RequestPathComponents.Components[3]
              else
                 TempEntityName:=''
              end
           else
              begin
              TempDataSetName:='';
              TempEntityName:='';
              end;
           end;
        case RequestMethod of
           rmGet:
              begin
              if (TempDataSetName='') then
                 begin
                 TempName:=GetParameter(SERVER_PARAM_NAME,False);
                 if (TempName='') then
                    TempName:=WILDCARD;
                 SendCustomContent(GetDataSetsJSON(TempName),MIME_COMPLETE_JSON_CONTENT_TYPE);
                 end
              else
                 begin
                 TempDataSetAdapter:=GetDataSetAdapter(TempDataSetName);
                 if (TempDataSetAdapter <> nil) then
                    begin
                    if (TempEntityName='') then
                       SendCustomContent(TempDataSetAdapter.GetColumnsJSON(Request,DatabaseName),
                                         MIME_COMPLETE_JSON_CONTENT_TYPE)
                    else if SameText(TempEntityName,SERVER_RESOURCE_DATA,loUserLocale) then
                       begin
                       TempColumnName:=GetParameter(SERVER_PARAM_COLUMN);
                       if (TempColumnName='') then
                          SendCustomContent(TempDataSetAdapter.GetRowsJSON(Request,DatabaseName),
                                            MIME_COMPLETE_JSON_CONTENT_TYPE)
                       else
                          begin
                          TempContent:=TempDataSetAdapter.GetRowColumn(Request,TempColumnName,
                                                                       TempContentType,DatabaseName);
                          SendRawCustomContent(TempContent,TempContentType);
                          end;
                       end
                    else
                       SendError(HTTP_NOT_FOUND,'Resource not found');
                    end
                 else
                    SendError(HTTP_NOT_FOUND,'Resource not found');
                 end;
              end;
           rmPost:
              begin
              if (TempDataSetName='') then
                 SendCustomContent(CommitTransactionJSON(Request,DatabaseName),
                                   MIME_COMPLETE_JSON_CONTENT_TYPE)
              else
                 SendError(HTTP_NOT_FOUND,'Resource not found');
              end;
           end;
        end;
     end;
end;

Also, the client application's TDatabase component instances will automatically try to automatically authenticate with the web server using a TServerSession component if it receives a 403 Forbidden response to a database request, so keep that in mind as it relates to your ISAPI DLL responses for database requests.

Please see here for more information:

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb3&topic=Database_Architecture

(under "Authentication" and "Core Components")

New documentation for the API:

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb3&topic=Server_Database_Access

https://www.elevatesoft.com/manual?action=viewtopic&id=ewb3&topic=Server_Database_Access_API

Tim Young
Elevate Software
www.elevatesoft.com
Image