Hands-on: Delphi Web Services with TMS XData
Creating Secure and Manageable Database-driven Web Services with TMS XData and Delphi
Watch Promo
This course will teach you step-by-step how to create TMS XData Web services in Delphi. The course is structured into topic groups and lectures. The total runtime of the videos is about 14 hours.
First, the main focus is to create a template that you will be able to use in all your future TMS XData projects. The template will get you set up to create Web services with:
- configurable database connectivity,
- server parameters in a resource file,
- a modern UI with tray icon,
- switching to deployment as a Windows service,
- logging
- access control using JSON Web Token (JWT)
This template will then be used to great a Web service for an example scenario. In this scenario, you will design a database, connect it to the template, implement the Web service backend, and then implement three clients. One VCL client to upload data from a CSV file into the Web service, and another VCL client to browse data from the Web service in a data grid and visualize it in a chart. The last client will be written in TMS WEB Core as an example for a Web client. All clients will implement user access control using JWT and a login dialog.
The course is grouped into the following sections:
Introduction
Detailed introduction to the course. Some videos are free to watch before purchase which will allow you to determine if this course hits "all the marks" for you.
I will start by giving an overview of all the course topics, describe the example scenarios, but will also motivate this course by giving examples for real-world Web services. Finally, we will prepare the development environment installing all the products and learning about TMS project wizards.
Create a new TMS XData project
Jump right into the development of a Web service with Delphi!
- You will learn how to create a new server and its associated project structure,
- get a glimpse at using version control, and
- where to download the source code of this course
The section will close with a detailed look at the different components of an XData server and how to set up Windows to host a server.
Updating the server container
The server container is the core part of an XData server and will be discussed in detail. In particular, we will introduce the Singleton pattern to facilitate its accessibility in the server application.
Adding services to the server
Services are the means how you can add functionality to your Web services. An XData server can hold as many services as you design. In this section, you will implement your first service and its endpoints. Lots of examples will be given. Focus will be how to look at the data that is returned, how the data is formatted, how you define the data that is returned, and how you can easily browse your XData server using SwaggerUI.
Adding database connectivity
Using databases with Web services is an essential part of this course. Learn how to connect a FireDAC database to the XData project and offer flexible connection parameters using a configuration file. The course will explain usage of FireDAC in a multi-threading environment in detail using FDManager and connection pooling.
Interlude I
Breathe! This section will give a summary of what has been covered so far and will test a few of the things that have been implemented.
Using resource files and UI design
After covering the basics, you will build the core parts of your server template starting with the server configuration that is stored in resource files. The user interface will also be updated to make it easily accessible for administrators.
Running as Windows service
The XData project will be migrated to a hybrid template that allows you to compile your project either as a VCL desktop application or a Windows service. This will make deployment to server machines very comfortable.
Logging
You need to know when your server deals with a request or when an error occurs. Logging these events is essential and this will be covered in detail in this section. Both alternatives using TMS BCL Logging and using output handlers from TMS Logging will be presented. The template will be using TMS Logging to log both to the Windows Event log, the UI, and a log file in CSV format.
Access Control with JWT
The final part of the template will add access control using JWT to the template. All your Web service operations can thus be protected to be only accessible by authorized users.
Interlude II
Another review of the course content.
The example scenario
All future sections build an example step-by-step based on the template. You will implement a real, working example using all the things learned in the previous sections - and more.
The example scenario will store workout health data in a Firebird database and will make it accessible using a Web service.
The database model is simple, but can be used to demonstrate the essential parts of every software development project.
Here is the UI of the XData server with logging that will be developed:
One VCL client will present the data in a grid and a chart:
Your Instructor
Course Curriculum
-
StartThank You! (1:58)
-
PreviewCourse Overview (18:56)
-
PreviewDescription of the example scenario (3:38)
-
PreviewExamples for real world Web services (12:09)
-
StartInstalling TMS Business products (5:54)
-
StartTMS XData Project Wizards I (7:26)
-
StartTMS XData Project Wizards II (7:04)
-
StartLooking at the software built in this course (8:27)
-
StartUsing the TMS XData VCL Server project wizard (2:00)
-
StartCreating the project structure on disk (5:29)
-
StartSource Code download and versioning (9:16)
-
StartLooking at the Server Container, REST-fulness of XData and HTTPS endpoints (11:07)
-
StartSparkle Dispatcher in detail (2:15)
-
StartBaseUrl of an XData server (6:57)
-
StartReserving HTTP endpoints in HTTP.SYS (3:28)
-
StartSetting the final values, cleanup (1:50)
-
StartChanging the auto-start behavior of the server (4:04)