Promotic
WikipediaLinkedInYoutubeTwitterFacebook

XML data sharing

XML data sharing is based on the Clinet-Server architecture, i.e. one application (Web server) owns the data and one or more applications (Web clients) read these data or write into them.

The PROMOTIC application can be both the Web server and the Web client for XML data.

 
In this case the PROMOTIC Web server for XML data is implemented by means of the PmData object (and its Web Server page) or by means of the PmDataTable object (and its Web Server page). The PmData/PmDataTable object represents a Web component. But in the application it is necessary to have one more PmWeb object that offers all Web components of the application as one Web server, see Overview of the WEB technology in the PROMOTIC system.

The PROMOTIC Web client for XML data is implemented also by means of the PmData/PmDataTable object and its methods ReadFromWeb and WriteToWeb. If the application has to be only the Web client, the PmWeb object needn't be present.

By this way two PROMOTIC application can simply exchange data in the real-time. PmData objects must contain the same data items in both (or more) applications, defined on the Data page.

For an example of the application see Example of communication by means of XML.

 
The PmDataTable object can dynamically change its data size by means of the methods InsertRow, RemoveRow, InsertCol or RemoveCol. But the size of data cannot be changed automatically by the XML transfer for security seasons! If, for example, it is necessary to change the size of data on the client application to be the same as on the server, then the number of rows on the server has to be got (e.g. by the XML query of PmData object), then to perform the change by the above mentioned method and only then to call the ReadFromWeb method.
 
The XML communication supports the transfer by a hierarchy method between the PmData objects. By this we mean that not only simple data items (as for example Integer, Single, etc.) find themselves in the PmData object but even a reference to the data of another PmData object can be a data item. Let's consider the case when the first item of the object /Data/DataA has to refer to the object /Data/DataB (both objects DataA and DataB are of the PmData type). Then the first data item of the DataA object must be of the Object data type and set, for example, the following by the script command:
Set pMe.Pm("/Data/DataA").Item(1) = pMe.Pm("/Data/DataB")

or instead of this it is possible to create a data binding PP Property of Promotic object or its subobject (Ini On property start) for the first data item. We fill in the path to the DataB object in this PP connection but we left the item for setting properties blank. Thus the first item of the DataA object is connected directly to the DataB object.

If the server and the client have these objects configured in the same way, then it is possible to transfer even the content of the DataB object together with the DataA object. This conception is advantageous if you have more PmData objects in the project but you want to transfer all of them in one message.

 
The Web client can be also for example HTML page viewed by the Internet Explorer. In this case it is possible to use the <xml> tag in the HTML page that allows to read XML data from the Web server. It is possible to use also the dynamic HTML and the Microsoft object Msxml2.XMLHTTP (written in 2004 year) that can read and write into the XML data.
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice