Promotic

Example of the communication by means of XML

Located in the Pma objects tree: /Examples/XmlServer. There are two applications (Client and Server) in this folder.
This is an example of the data transfer between two PROMOTIC applications via Ethernet. XML is the standard for data transfer by the HTTP protocol. For the general description of the XML communication see XML data sharing. For full testing of the XML communication it is advisable to use two computers (even more) connected in the network. The XML Server application is started on one computer, the XML Client application is started on the other (third..). The communication can be tested also on one computer, the XML Server application can be started together with the XML Client application.

XML server - PROMOTIC example of XML communication

Description of controlling the application:
After the application is launched, the emulation of provided data starts. The user can control the data emulation by the buttons "Stop data emulation/Start data emulation" and "Reset data".

Description of the application implementation:
The XML Server application is an example of the communication for providing data in the network by means of the XML communication. The whole XmlServer object can be used (after copying and setting) in the real applications, where the data have to be provided to other applications by means of the network (Intranet) or by means of the Internet. The provided data can be browsed even by the Web browser without installing the PROMOTIC system.

- The Data1 object in the Pma objects tree serves for the emulation of the data that are further provided to other applications in the XML format. On the "Methods" tab the designer's "NulData" method is defined that serves for setting the emulated data to original (null) values. The method uses both the "Reset data" button and also the Timer object (see the condition in the onTick script). The TestXml object serves for the data visualization, for controlling the data emulation. The Data1 object serves for saving the emulated data. On the "Web server" tab there is checked "Enable as Web component" configurator, link to the PmaWeb object and the identifier of provided component is defined.
The provider (XML Server) and the user (XML Client) must have the same type of the shared data (componenets) and their identifier.
- The "Web" object provides the data in the XML format.

XML client - PROMOTIC example of XML communication

Description of controlling the application:
After the application is launched, at first the window opens where a Server name is set, i.e. the computer name where the data provider XML Server runs. After setting the Server name, the window for controlling the communication opens as next. The user has the "Start data receive/Stop data receive" button available, by which enables/disables reading the data from server in regular intervals. Further, the "Stop receiving data" button and tthe "Send null data" button, by which original (null) data are sent to the server. In the "Communication period" edit box it is possible to set the communication period (see the PmaTimer object) in seconds after the communication is stopped. If the period is set to 0 seconds, the communication is not performed in regular intervals, but reading the data is performed immediately after the previous reading has been finished. The read data are displayed in the data panel, and moreover, the user has the "Transmission statistics" window available where success rate of individual transfers is evaluated.

Note: The server name (of the computer where the XML Server runs) can be found on the computer in "Control Panel" and then the "Network" item.
The IPv4 server address can be used for connection.


Description of the application implementation: The XML Client application is an example of the communication, providing the data in the network by means of the XML communication. The whole XmlClient object can be used (after copying and setting) in the real applications, where the data have to be received or sent to other applications by means of the network (Intranet) or the Internet.

- The AddrSrv object is used for entering the computer name that is running the XML server (i.e. computer name of the data provider). The address is stored in the Data_Par object into "Addr" data. In the "Open the window for Data1 communication" button the Pm.CreateView method is used for opening the panel displaying transmitted data.
- The Data1 object in the Pma objects tree serves for reading or sending the data. On the "Methods" tab there are defined methods for reading or sending the data to the XML Server.
- The "Read" method - reads the data from the XML Server
- The "Write" method - sends the null data (the "Send null data" button).
- The TestXml object serves for visualization of the data, for controlling the communication.
- The "ReadStart" method - enables reading the data (the "Start receiving data" button).
- The "ReadStop" method - stops reading the data (the "Stop receiving data" button).
- The "Write" method - sends the null data (the "Send null data" button).
- The Timer object calls the "Read" method (in the onTick event). Here the period for the reading is set (the "Timer" tab).
- The DataRead object serves for saving the read data. On the page in the onEndOfTransfer event the success rate of the reading is evaluated and also the reading is started with the period 0 seconds (see the condition).
- The DataWrite object are the null data for sending.
- The Statistic object serves for saving the statistics values of the success rate of the communication.


The Data_Par object in the Pma objects tree serves for specifying the basic communication parameters.
- "Addr" It is used for storing the server address (Server name).
- "Period" It is used for storing the value of the period from the "Communication period" edit box.
- "Reading" It is used for storing the enable/disable flag of reading.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.