Promotic

ReadFromWeb - method of the PmaData object

Description:
Reading the data from Web server in the XML format into this object.
Syntax:
Boolean ReadFromWeb(String URL, [String sUser], [String sPassword])
Parameters:
URL(String) The URL address of the data Web server where the XML data are stored.
The PROMOTIC application as the Web server offers the data usually on the path (see the "PmaData > Web server" tab):
http://ComputerName:Port/ComponentId/data.xml?fmt=purevalue

Caution! Beginning of the address ("http:") must be entered! If you want to enter the address of the local computer, then it is possible to enter the localhost word as the ComputerName. The Port needn't be entered if the Web server is on the standard port 80.
The communication also works on secured Web server at address https://....
fmt - Named format of the sent XML data.
purevalue - Shortened text format containing only the values separated by semicolon. This format can be used for sending values of all variables.
xmlpurevq - A shortened text format containing the values and qualities separated by semicolon. This format is suitable for sending values and qualities of all variables.
full - Extended text XML format containing values and variable names. This format can be used for sending values of some variables.
sUser[optional] (String) User name for the authentication. See "WebRead" permission on the server. If not set and the site requires the authentication, then the onEndOfTransfer event is triggered with the pEvent.Error=62.
sPassword[optional] (String) Password of the user for the authentication. This parameter is ignored if the sUser parameter is missing.
Return value:
true - The method successfully queued the request for reading data from server. After data transfer the onEndOfTransfer event is triggered.
false - The method hasn't queued the request for reading data. Probably the previous request about sending/receiving of this object hasn't been finished yet. The onEndOfTransfer event is not triggered.
Note:
This method is not functional for PmFree.

By calling the ReadFromWeb method over the object, this object is regarded as the Web client that reads data from the component of the Web server - in this case from another but the same configured PmaData object in another application on the same or another computer.
The method only activates the data transfer but there is no assurance that data are already transferred after ending this method. The data transfer termination is announced by the the onEndOfTransfer event. During the data transfer (i.e. in the time after calling the ReadFromWeb method and before the onEndOfTransfer event is triggered) the ReadFromWeb nor the WriteToWeb method cannot be called over the object again - then the method returns the false value. By means of the WebClientIsReady property it can be found out if the object is ready for the next transfer.
Variables on the "Data" tab of this object are filled up by the incoming data.
Example:
JavaScriptVBScriptSelect and copy to clipboard

var oData = pMe.Pm("Data/Param1");
if (oData.WebClientIsReady)
{
oData.ReadFromWeb("http://localhost/param/data.xml?fmt=purevalue", "Johny", "abcd");
}
else
{
Pm.Debug("Web client PARAM is not ready (is still active)");
}

History:
Pm9.00.18: New format of xmlpurevq for sending values and qualities of variables
Pm8.00.11: If the application tried to read Web pages from itself (e.g. by the PmaData.ReadFromWeb method, when the URL address is address of this application), then the data was read with an error.
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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