Promotic
WikipediaLinkedInYoutubeTwitterFacebook

ReadFromWeb - method of object PmData

Description:
Reading data from WEB server in the XML format into this object
Syntax:
ReadFromWeb(URL As String, [sUser As String], [sPassword As String]) As Boolean
Calling:
b = oData.ReadFromWeb("http://ComputerName/ComponentId/data.xml?fmt=purevalue", "User", "Password")
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 by default on the path (see the page PmData > Web Server):
http://ComputerName:Port/ComponentId/data.xml?fmt=purevalue

Caution! Head of the address ("http:") must be entered! If you want to enter the address of the local computer, 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.

sUser[optional] (String) Name of the user for the authentication. See the WebRead permission on the server side. If this parameter is missing and the site requires the authentication, then the onEndOfTransfer event fires with the pEvent.Error=40.
sPassword[optional] (String) Password of the user for the authentication. This parameter is ignored if the sUser parameter is missing.
Return Values:
true - The method successfully queued the request for reading data from the server. After data transfer the onEndOfTransfer event will be fired.
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 fired.
Note:

By the fact that the ReadFromWeb method is called 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 PmData 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 onEndOfTransfer event. During the data transfer (i.e. in the time after calling the ReadFromWeb method and before the onEndOfTransfer event fires) the ReadFromWeb nor the WriteToWeb method cannot be called over the object again - then the method returns the false value. Using the WebClientIsReady property it can be found out if the object is ready for the next transfer.

Variables on the Data page of this object are filled up by the incoming data.

Example:
Dim oData
Set oData = pMe.Pm("Data/Param1")
If oData.WebClientIsReady Then
  oData.ReadFromWeb "http://localhost/param/data.xml?fmt=purevalue", "Johny", "abcd"
Else
  Pm.Debug "WebClient PARAM is not ready (is still active)"
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice