Preconfiguration "HttpRequest - Receiving data in the JSON format"

HttpRequest data receiving and processing in the JSON format

This preconfiguration can be activated when creating a new object (e.g. by "New object ..." in the local object menu or by pressing the Insert key after selecting the object) and is included in the group: "/ Communication / Protocols and other communications / HTTP - XML, JSON, CSV, SOAP, text".
This preconfiguration can be created in the object: PmaFolder or PmaRoot.

- The preconfiguration is created including the panel (object of the PmaPanel type) is functional also as Web panel.

The preconfiguration creates an object of the PmaFolder type containing two subfolders:
Commun - allows communication with defined URL that contains the JSON format data
Test - creates graphic panel for testing URL addresses

Commun - PmaFolder
Main object configured as communication driver. The PmaFolder object has the StartReceive method for initialization of the communication. The method has following parameters:
msgId - user identifier of the communication
msgUrl - data source URL address
msgPar - user parameter of the message
oRcv - the resulting data of the communication will be passed to the onReceive method of this object. In this object must be the "onReceive" method that can process the received data.

These parameters are passed in the Add method of the PmaSequencer object.
The PmaSequencer object is configured in order to have each communication running outside the main working thread of the PROMOTIC application. In the onStep event, there is an ActiveX object "Microsoft.XMLHTTP" that gets the corresponding parameters for synchronous mode communication by the "open" method. The "send" method follows and receives or sends the data. The received data can be then processed as needed. The transmission is terminated by the abort method.

Test - PmaFolder The Test subobject with panel and data can be used for communication testing. The "onReceive" method provides communication error detection and suggestion of received data processing. In panel method GetMsgList, there are three functional URL addresses with identifiers that it is possible to choose in the panel in order to test the communication. In this panel it is also possible to test any other URL address entered in the PmgString object Msg Url address:

These configurators can be set before the preconfiguration is created:
The name of created objectName of the object created in the Pma objects tree. The maximum name length is 30 characters. This is a system name, so it must contain only alphanumeric and must not contain any diacritics (i.e. national dependent characters), empty string, spaces and the first character must not be a number.
Default: "JsonHttpReq"

Pm8.03.19: Created
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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