WriteToWeb - method of object PmData

Send the values of variables (see the "Data" page) of this object into the PROMOTIC Web server as XML data.
WriteToWeb(URL As String, sParam As String) As Boolean
oData.WriteToWeb "http://ComputerName/ComponentId/data.xml", sParam

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 by default on the path (see the PmData > Web server page):


Caution! Head 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 on address https://....

sParam(String) Additional parameters of the transfer. It is the text in the form, for example: "fmt:purevalue;user:NAME1;psw:PASSWORD1;".
fmt (mandatory) - 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.
full - Extended text XML format containing values and variable names. This format can be used for sending values of some variables (see the vars parameter).
user - User name for the authentication. See the WebWrite permission on the server side. If not set and the site requires the authentication, then the onEndOfTransfer event fires with the pEvent.Error=40.
psw - Password of the user for the authentication. This parameter is ignored if the user parameter is missing.
vars - List of variables names that are to be transmitted. This parameter can be used only if the fmt parameter is set to full.
Return Values:
true - The method successfully queued the request for writing data to the server. After data transfer the onEndOfTransfer event will be fired.
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 fired.

This method is not functional for PmFree.

By the fact that the WriteToWeb method is called 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 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 event onEndOfTransfer. During the data transfer (i.e. in the time after calling the WriteToWeb method and before the onEndOfTransfer event fires) the WriteToWeb nor the ReadFromWeb 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.

Up to the version Pm8.2.7, the method had two more parameters and the 2nd parameter "sParam" had different meaning (2nd parameter was fmt, 3rd parameter was user and 4th parameter was psw). For example

oData.WriteToWeb "http://ComputerName/ComponentId/data.xml", "purevalue", "User", "Password"

This way of calling is considered obsolete (even if it is still functional).

Send the values of all variables
VBScriptSelect and copy to clipboard

If oData.WebClientIsReady Then
  oData.WriteToWeb "http://localhost/temperatures/data.xml", "fmt:purevalue;user:oper;psw:abcd;"
  Pm.Debug "Web client is not ready (is still active)"
End If
Send the values of selected variables temp1,v3,press
VBScriptSelect and copy to clipboard

If oData.WebClientIsReady Then
  oData.WriteToWeb "http://localhost/boiler/data.xml", "fmt:full;vars:temp1,v3,press;user:oper;psw:abcd;"
  Pm.Debug "Web client is not ready (is still active)"
End If
PROMOTIC 8.3.30 SCADA system documentation - MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice