Creating the Server Application
Go Up to Creating Multi-Tiered Applications Index
You create an application server very much as you create most database applications. The major difference is that the application server uses a data module.
To create a server application
Note: Some of the following wizards require a new VCL Form application project and, for Transactional Data Module, you need to have added to the project an ActiveX Library, which can be found on the ActiveX page.
- Start a new project:
- To use the new DataSnap technology, create the Server application using the DataSnap Server Wizard or follow the steps mentioned in the Tutorial: Using a DataSnap Server with an Application. In the DataSnap Server Wizard you can add a TDSServerModule.
- If you are using SOAP as a transport protocol, this should be a new Web Service application. Choose File > New > Other, and on the WebServices page of the new items dialog, choose SOAP Server Application. Select the type of Web Server you want to use, and if prompted whether you want to define a new interface for the SOAP module, say no.
- For any other transport protocol, you need only choose File > New > Application .
- Save the new project.
- Add a new remote data module to the project. Except for Server Data Module (which can be added from DataSnap Server Wizard), choose File > New > Other , and on the Multitier or WebServices page of the New Items dialog box, select:
- Remote Data Module if you are creating a COM Automation server that clients access using DCOM, HTTP, or sockets.
- Transactional Data Module if you are creating a data module that runs under COM+ (or MTS). Connections can be formed using DCOM, HTTP, or sockets. However, only DCOM supports the security services. (In order to access the wizard, you need to have added to the project an ActiveX Library, which can be found on the ActiveX page.)
- SOAP Server Data Module if you are creating a SOAP server in a Web Service application.For more detailed information about setting up a remote data module, see Setting up the data module.
- Place the appropriate dataset components on the data module and set them up to access the database server.
- Place a TDataSetProvider component on the data module for each dataset you want to expose to clients. This provider is required for brokering client requests and packaging data. Set the DataSet property for each provider to the name of the dataset to access. You can set additional properties for the provider. See Using provider components for more detailed information about setting up a provider.If you are working with data from XML documents, you can use a TXMLTransformProvider component instead of a dataset and TDataSetProvider component. When using TXMLTransformProvider, set the XMLDataFile property to specify the XML document from which data is provided and to which updates are applied.
- Write application server code to implement events, shared business rules, shared data validation, and shared security. When writing this code, you may want to do the following:
- Extend the application server's interface to provide additional ways for the client application to call the server.
- Provide transaction support beyond the transactions automatically created when applying updates.
- Create master/detail relationships between the datasets in your application server.
- Ensure your application server is stateless.
- Divide your application server into multiple data modules.
- Save, compile, and register or install the application server.
- DataSnap using dbExpress does not require any runtime.
- If your server application uses TCP/IP sockets or HTTP connections, you must install the runtime software that receives client messages, instantiates the remote data module, and marshals interface calls.
- For TCP/IP sockets this is a socket dispatcher application, Scktsrvr.exe.
- For HTTP connections this is httpsrvr.dll, an ISAPI/NSAPI DLL that must be installed with your Web server.
Topics
- Filtering the DataSnap Communication Stream
- Setting Up the Data Module
- Using Multiple Server Data Modules (COM)
- Extending the Interface of the Application Server (COM)
- Managing Transactions in Multi-tiered Applications (COM)
- Supporting Master/detail Relationships
- Supporting State Information in Exposed Data Modules