Promotic

WriteToWeb - method of the PmaDataTable object

Description:
Sending data of this object to Web server in the XML format.
Syntax:
Boolean WriteToWeb(String URL, String sParam)
Parameters:
URL(String)
The URL address of the data Web server where the XML data have to be sent. The PROMOTIC application as the Web server offers the data usually on the path (see the "PmaDataTable > Web server" tab):
http://ComputerName:Port/ComponentId/data.xml

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://....
sParam(String) Additional parameters of the transfer. This is the text in the form, for example: "fmt:purevalue;user:NAME1;psw:PASSWORD1;".
fmt (mandatory) - Named format of the sent XML data. The PROMOTIC system in the meantime offers only the "purevalue" format.
user - User name for the authentication. See "WebWrite" permission on the server. If not set and the site requires the authentication, then the onEndOfTransfer event is triggered with the error pEvent.Error=40.
psw - Password of the user for the authentication. This parameter is ignored if the user parameter is missing.
Return value:
true - The method successfully queued the request for writing data to the server. After data transfer the onEndOfTransfer event is triggered.
false - The method hasn't queued the request for writing 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 WriteToWeb method over the object, this object is regarded as the Web client that writes to the component of the Web server - in this case to another but the same configured PmaDataTable 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 WriteToWeb method and before the onEndOfTransfer event is triggered) neither the WriteToWeb method nor the ReadFromWeb method can 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.

The client cannot change the data amount assigned to him on the server by the WriteToWeb method - for example, by sending more data than it is set on the server. If this is requested, then the server itself has to make this change first - see the description in chapter XML data sharing.
Example:
JavaScriptVBScriptSelect and copy to clipboard

var oDataTable = pMe.Pm("/DataTable");
if (oDataTable.WebClientIsReady)
{
oDataTable.WriteToWeb("http://ComputerName:Port/ComponentId/data.xml", "fmt:purevalue;user:oper;psw:ABCD");
}
else
{
Pm.Debug("Web client is not ready (is still active)");
}
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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