The Web server is an application that provides Web pages (
HTML, XML, BMP, etc. files) into the Internet/Intranet and then these pages are viewed by the Web browser (
Chrome,
Firefox,
Edge,
InternetExplorer ...). The PROMOTIC application can become such Web server and the following text describes the principles of creating such application.
The The PROMOTIC application as the Web server has
advantages first of all from the following reasons:
- Clients (on other computers) that want to browse data (from the PROMOTIC Web server), needn't install the PROMOTIC system. Clients can browse these data only by the Web browser (Chrome, Firefox, Edge, InternetExplorer ...).
- Other applications (on the same or another computer) make use of offered data and are processing them. Such applications can be again PROMOTIC applications but even others that can process for example XML data.
- The data transfer is based on the standard of the
HTTP protocol (or its secured variant
HTTPS see
HTTPS - secured HTTP protocol) and therefore the data can be transferred even via Ethernet.
Company firewalls transmit the HTTP protocol (standard port
80) and HTTPS protocol (standard port
443) by default and thus it isn't necessary to do big changes into these devices.
Caution! The Web server in
licenced in the PROMOTIC system, i.e. that for running in runtime (with runtime licence) it is necessary to purchase an item for network users into the runtime licence (
Data or Web client - according to the type of offered Web components - see further). It is necessary to purchase as many licences as how many clients the application is supposed to communicate with in one moment (
10 minutes) at the most. See the
PROMOTIC system price list.
- The
Development key contains 10 available clients of the
PmWebClient type for testing purposes.
- In the
PmFree type application, there are 2 available clients of the
PmWebClient type.
The PROMOTIC application becomes the Web server if you place the
PmaWeb object into this application. Usually there is only one such object in the application. This object is responsible for the fact that any Web component of the PROMOTIC system is registered into this object and then this component offers its data. Each PROMOTIC Web component (for the list of components see further) has unigue text identifier (we'll mark it further as "ComponentId").
The runtime information regarding the status of the PROMOTIC Web server communication with its clients (the statistics of HTTP transfers, the contents of the last transfers, etc.) can be observed in the "
/COMM/WebServer" item of the INFO system.
In the
PmaWeb object it can be set so-called
port. The port is important information for the data transfer via Ethernet (TCP/IP). The standard value is
80 for HTTP and
443 for HTTPS.
If the PROMOTIC application becomes the Web server, then each its Web component is accessible in the intranet at URL:
http://ComputerName:Port/ComponentId/default.htm
or if the port in the
PmaWeb object is set to the standard value, then in simpler way:
http://ComputerName/ComponentId/default.htm
The
default.htm page is usually only the basic page of the component. The component offers even (usually many) other pages, not only with the
.htm extension but also
.xml,
.png, etc. respectively. On the
default.htm page there is usually a list of these next possible pages with links to them.
The
PmaWeb object itself offers also its own page. Thus it is also the component but with the empty identifier. There is a list of Web components of the application with links to them on this page. The address of this page is as follows:
http://ComputerName:Port/default.htm
You can also reach this page by the simpler address (on the standard port):
Possibilities of Web data offering are circulating quickly in the PROMOTIC system. Let's summarize now all, the PROMOTIC application can offer as the Web server. In the PROMOTIC application there are the following objects as the Web component:
-
PmaPanel: (see "
Web server" tab) Offers visual views (including control and current data transfer) as dynamic HTML page.
-
PmaReport: (see "
Web server" tab) Offers the user HTML page with the possibility of very general modifications of this page before it is provided to the client.
-
PmaWebFolder: Allows to create hierarchic level of URL adress.
-
PmaWebDir: Offers the files in specific folder as static Web pages.
-
PmaWebLang: Offers the national language selection.
By these objects the PROMOTIC application offers the following data:
1. Application workspace (PmaWorkspace)
The
PmaWorkspace object can be used for offering the application workspace layout, so that multiple windows (frames) are available simultaneously. In some frames, the HTML pages of the
PmaPanel object are displayed, while another may contain different Web components namely
PmaReport,
PmaWebDir, etc. The framework of the visual layout is based on the dynamic pages of the
PmaPanel object.
The client requiring data from this Web component is of the
PmWebClient type from the licence point of view.
2. Panels of the application (PmaPanel)
The panels of the application can be offered to Web server by the
PmaPanel object.
The
PmaPanel object offers its data in the form of dynamic HTML pages that (if it is enabled in the "
Enable as Web component" configurator) are
created automatically. These pages have some limitations in comparison with the panels that are started directly in the PROMOTIC application. For the description and limitations, see
Web panels.
The
PmaPanel object also offers static pages of the panel. On the request of the Web client, the object creates the current image (in the PNG file format) and sends it to the client.
The client requiring data from this Web component is of the
PmWebClient type from the licence point of view.
3. Application reports (PmaReport)
The application reports can be enabled to Web server by the
PmaReport object.
The client requiring data from this Web component is of the
PmWebClient type from the licence point of view.
4. Current data in the XML format (PmaData, PmaDataTable)
The application offers current data that are located in the
PmaData and
PmaDataTable object. These objects are then the Web server of the data, see the "
Web server" tab. The offered data are in several possible formats of the XML text. This offering allows reading and writing into the
PmaData/
PmaDataTable object. See also:
XML data sharing.
The first usage is the
communication between two or more PROMOTIC applications. The first application has the
PmaData/
PmaDataTable object set as the Web server and the other has the identical object set as the Web client. The Web client reads or writes data to Web server (see
PmaData.WriteToWeb method and
PmaData.ReadFromWeb method).
The second usage is
on viewing dynamic HTML pages. If the HTML pages whose content has to be changed, are offered, then it is necessary to refresh these pages periodically, which is slow and causes blinking. By the XML a dynamic HTML page can be created that reads periodically the XML data on background and it refreshes only necessary visual parts. This approach is at present the best one for creating "animated" HTML pages. But if the designer wants to create such page, then he must have the knowledge about making the dynamic HTML pages and using the XML. This can be too ambitious and therefore simpler walkthroughs exist in the PROMOTIC system about how to create "animated" HTML pages - see further.
Of course it is possible to use the offered XML data
to lots of other purposes because the work with the XML data begins to be one of the biggest standard in the computer world. Thanks to this it is possible to offer data to other operating systems such as
UNIX,
LINUX, etc.
The client requiring data from this Web component is of the
PmDataClient type from the licence point of view.
5. Creating tree structure of Web components addresses (PmaWebFolder)
The
PmaWebFolder object represents the Web address, into which Web addresses of other Web component can be inserted. A suitable tree structure of Web components addresses can be created. For example, there can be Web components of all data on one address, components for panels on the next address, of trends, alarms, on the next, etc.
6. Offering HTML pages created by the application designer (PmaWebDir)
The
PmaWebDir object offers HTML (but even other) files that are located in the specified folder on the disk. The client asks for the file and the Web server finds this file in this folder and sends it to the client.
This wouldn't be too useful because only static pages would be offered. Thus the
PmaWebDir object has a conception that allows to change the static disk file by the current state before sending to the client. This is enabled by means
of keywords that are written into the static HTML page and then these keywords are replaced by current values before sending. Thus the keyword can be replaced for example by the number, that represents temperature, by the determination of background color, even by the part of the HTML text and thus to display different data in different time.
By this it is possible in a very simple way to create even very universal "animated" pages.
The client requiring data from this Web component is of the
PmDataClient type from the licence point of view.
7. Download of files
The
PmaWebDir object allows to choose the folder (containing files) on the server that will be offered to the Web client for viewing or download. See:
Download of files
9. INFO system
The
PmaWebInfo object offers HTML pages where the information of the
INFO system are placed. These Web pages are generated automatically and thus the designer can find out very easily that the information about running the application can be watched remotely via the Web.
The client requiring data from this Web component is of the
PmDataClient type from the licence point of view.
10. Language versions of HTML pages (PmaWebLang)
The
PmaWebLang object represents the language selection, i.e. offers a Web page where the language can be selected. When the language is being selected the component list is displayed, registered into the
PmaWebLang object. All of these components will be displayed in selected language.
For example, if object the
Web panel (
PmaPanel object) is registered into the
PmaWebLang object, then the automatically translated HTML page in this panel and all the included texts entered using the
Macro expression $.text, will be displayed in selected language.
11. Web browser (/#glob/webbrowser)
The WWW page browser allows the PROMOTIC application to display outer Web pages in the internal viewer. See
Web browser (/#glob/webbrowser)