DataSnap REST Application Wizard for Windows

From RAD Studio
Jump to: navigation, search

Go Up to DataSnap REST Application Wizard


File > New > Other > Delphi Projects > DataSnap Server > DataSnap REST Application
File > New > Other > C++Builder Projects > DataSnap Server > DataSnap REST Application

To create the DataSnap REST Application for Windows, select Windows in the DataSnap REST Application Wizard and follow the steps below.

WebBroker Project Type page

On this page, select the type of DataSnap REST Application.

  1. Select the required type of DataSnap REST Application:
    • Apache dynamic link module: a server that hosts static or dynamic websites, providing secure and efficient web server features as CGI (Common Gateway Interface), SSL (Secure Sockets Layer), and virtual domains. Apache supports HTTP and HTTPS.
    • Stand-alone console application: a web server with a text-only user interface. It supports HTTP by using an Indy HTTP server component.
    • Stand-alone application: a web server that displays a form. It supports HTTP by using an Indy HTTP server component.
    • ISAPI dynamic link library: ISAPI and NSAPI web server applications are shared objects that are loaded by the web server. Client request information is passed to the DLL as a structure and evaluated by TISAPIApplication. Each request message is handled in a separate execution thread. When you select this type of application, the library header of the project files and the required entries are added to the uses list. Also, the clause of the project file is exported. ISAPI libraries integrate with IIS. IIS supports HTTP and HTTPS.
    • CGI stand-alone executable: a console application that receives client request information on standard input and passes the results back to the server on standard output. This data is evaluated by TCGIApplication. Each request message is handled by a separate instance of the application. Selecting this type of application adds the library header of the project files and required entries to the uses list and exports clause of the project file.
  2. Click Next.

DataSnapREST win01.png

Application Type page

On this page, you can select the type of your DataSnap REST Application.

  1. Select the type of DataSnap REST Application you want to create:
  2. Click Next.

DataSnapREST win02.png

Apache Module Options page

This page opens only if you selected the Apache dynamic link module on the WebBroker Project Type page.

Specify the following:

  1. Apache version
  2. Apache module
  3. Apache unit: this value is predefined. You cannot edit it.
  4. Click Next.

DataSnapREST win03.png

Port Number page

On this page, specify the ports that the DataSnap REST Application will use to listen to the client requests.

  1. To check the availability of the specified port, click Test Port.
  2. To select an open port automatically detected by the DataSnap REST Application, click Find Open Port.
  • Note: Select the HTTPS check box to use the HTTPS protocol. The HTTPS communications port will be set to 443, which is a port commonly used by IIS, and the wizard will display an additional step that prompts for information regarding the X.509 certificate files.

DataSnapREST win04.png

X.509 Certificates page

This step appears only if you select the HTTPS communication protocol on the Port Number page.

  1. To use the X.509 certificates, enter the following data:
    • Certificate file name: holds the X.509 certificate (*.pem).
    • Key file name: holds the key.
    • Key file password: contains the password for the key file.
    • Root certificate file name: holds the root certificate.
  2. To validate the selection, click Test.
  3. Click Next

DataSnapREST win05.png

Server Features page

On this page, you can select the set of features required for your application.

  1. Select the features you want to add to the DataSnap REST Application.
  2. Click Next.
Tip: For more details on each feature, click it and see the description in the Info section.

DataSnapREST win06.png

Authentication

Select the Authentication option to place the TDSAuthenticationManager component on the server form.

The TDSHTTPWebDispatcher component uses TDSAuthenticationManager as the AuthenticationManager to allow the implementation of HTTP user authentication for the DataSnap server. The implementation consists in implementing the Authenticate property. When Authentication is selected, the client needs to provide the DataSnap user name and password as SQL connection properties.

Server Methods Class

Select the Server Methods Class option to add the TDSServerClass component to the server form. It allows defining a class on the server, which exposes server methods to client applications.

If you select the Sample Methods option, then the ServerMethodsUnit will contain the implementation of two simple methods called EchoString and ReverseString, which return the Value given as parameter in normal respective reversed states.

Selecting the Sample Web Files option results in adding a set of sample web files and related pages to this project. They all can be seen in the Projects Window under this DataSnap server project. Inspect the files inside the templates directory to observe the actual Web implementation for the ServerFunctionInvoker and ReverseString methods.

Simplified Dispatcher

Use TDSRESTWebDispatcher rather than TDSHTTPWebDispatcher. The REST dispatcher supports REST only. The HTTP dispatcher also supports DBX/Native HTTP connections.

Mobile Connectors

Select Mobile Connectors to include support for proxy dispatching for mobile connector development.

Server Module

Select the Server Module option to create a separate module for DataSnap server components. This enables support for heavyweight callbacks in DataSnap REST Applications.

Server methods ancestor class page

On this page, select the ancestor type of the server methods class.

  1. Select one of the following ancestor types:
    • TComponent: to provide a simple code-only implementation.
    • TDataModule: to use nonvisual components in your server class.
    • TDSServerModule: to expose datasets from the server to client applications.
  2. Click Next.

DataSnapREST win07.png

Project location page

This step appears only if you selected Mobile Connectors on the Server Features page of this wizard.

  1. Click Browse and select the root location where your application will be stored.
    Tip: Type the root directory of the web application you are about to create. This is the output directory of the project executable and the location of web application files such as .js, .html, and .css, and other static files.
  2. Click Finish.

DataSnapREST win08.png

See Also