JSON/XML Driver
Not counted towards your tag license limit.
Given a fixed URL Uniform Resource Locator. The address of a web page., the driver will read the JSON JavaScript Object Notation or XML data at that address and turn it into a nested VTScada dictionary with arrays.
Data may be read by attached I/O tags such as Analog Status, Digital Status or String I/O as appropriate. The address will depend on the structure of the JSON or XML file, therefore an Address Assist dialog is provided. All I/O tags linked to this driver will gain an address assist button automatically. The contents of the resulting dialog will be populated from the file. If the file cannot be read for any reason, then no addresses will be available.
Supports responses compressed via deflate or gzip methods.
The JSON/XML driver works in one direction only: it reads data into VTScada. It does not write data out to external URLs.
Multiple JSON/XML drivers connecting to the same domain will do so sequentially by default. This may cause unnecessary wait times. Configure your application so that your JSON/XML drivers connect to a specific domain in parallel for more efficient simultaneous data transfer. See Connect JSON/XML Drivers in Parallel for more information.
Error codes
JSON/XML drivers connect to web servers. Therefore, most errors that you might see will be a standard HTTP code. 401 (unauthorized access attempt) and 404 (page not found), are common. Other possible error codes include:
- -1: Connection timed out
- -2: Response timed out
- -3: Invalid (non-HTTP) response
- -4: Incomplete response
- -5: Unsupported transfer-encoding
- -6: Missing parameters
The ID tab of every tag includes the same common elements: Name, Area, Description, and Help ID.
Name:
Uniquely identifies each tag in the application. If the tag is a child of another, the parent names will be displayed in a separate area before the name field.
You may right-click on the tag's name to add or remove a conditional start expression.
Area
The area field is used to group similar tags together. By defining an area, you make it possible to:
- Filter for particular tag groups when searching in the tag browser
- Link dial-out alarm rosters to Alarm tags having a particular area
- Limit the number of tags loaded upon startup.
- Filter the alarm display to show only certain areas.
- Filter tag selection by area when building reports
When working with Parent-Child tag structures, the area property of all child tags will automatically match the configured area of a parent. Naturally, you can change any tag's area as required. In the case of a child tag, the field background will turn yellow to indicate that you have applied an override. (Orange in the case of user-defined types. Refer to Configuration Field Colors)
To use the area field effectively, you might consider setting the same Area for each I/O driver and its related I/O tags to group all the tags representing the equipment processes installed at each I/O device. You might also consider naming the Area property for the physical location of the tag (i.e. a station or name of a landmark near the location of the I/O device). For serial port or Roster tags, you might configure the Area property according to the purpose of each tag, such as System or Communications.
You may define as many areas as you wish and you may leave the area blank for some tags (note that for Modem tags that are to be used with the Alarm Notification System, it is actually required that the area field be left blank).
To define a new area, type the name in the field. It will immediately be added. To use an existing area, use the drop-down list feature. Re-typing an existing area name is not recommended since a typo or misspelling will result in a second area being created.
There is no tool to remove an area name from VTScada since such a tool is unnecessary. An area definition will exist as long as any tag uses it and will stop existing when no tag uses it (following the next re-start).
Description
Tag names tend to be brief. The description field provides a way to give each tag a human-friendly note describing its purpose. While not mandatory, the description is highly recommended.
Tag descriptions are displayed in the tag browser, in the list of tags to be selected for a report and also on-screen when the operator holds the pointer over the tag’s widget. For installations that use the Alarm Notification System, the description will be spoken when identifying the tag that caused the alarm.
The description field will store up to 65,500 characters, but this will exceed the practical limits of what can be displayed on-screen.
This note is relevant only to those with a multilingual user interface:
When editing any textual parameter (description, area, engineering units...) always work in the phrase editor. Any changes made directly to the textual parameter will result in a new phrase being created rather than the existing phrase being changed.
In a unilingual application this makes no difference, but in a multilingual application it is regarded as poor practice.
Help Search Key
Used only by those who have created their own CHM-format context sensitive help files to accompany their application.
The Settings tab includes the following properties:
URL
This is the address of the file containing either JSON or XML-formatted data to be read by the driver.
Use the selector below the address to specify which of the two supported data types will be found at this URL. If the URL does not specify a port number, then it will default to 80 for unsecured connections and 443 for secured connections.
Username and Password
If required by the remote system, provide the Username and Password required to access the file. Note that the password will displayed as "***" characters and will be stored in an encrypted form.
Polling Interval
Set the frequency in seconds for fresh reads of the URL. This defaults to 60 seconds.
Processor
The name of a JSON/XML processor. Standard (the default processor) supports live values being read from the site, but does not provide support for timestamped historical data, forecast data, or dynamic data where the payload structure can change. For these cases, you can write your own processor that will handle complex data structures. See: Write a JSON/XML Processor
Connection Time Limit (s)
Sets the time in seconds that the driver will wait for a response before it gives up and retries or sets an error if all retries have been attempted.
Retries
The number of times to retry a message before declaring an error.
Use only if the driver is connected to a device that uses a serial port or a UDP/IP port that is configured to be polled. When connected directly to a device using TCP/IP, this value should normally be set to 0 since TCP/IP is a guaranteed message delivery protocol.
For unreliable communications, such as radio, set to 3 or 4.
Max Request Rate (per second)
The maximum number of requests to send per second to the host. The default is an unlimited rate.
A limited rate is necessary for situations where a host may reject a client if it has received more than X requests per second from that client.
Typically, all driver instances that use the same host would be configured with the same Max Request Rate, but this is not required. Each driver will enforce only its own specified rate limit.
Hold
Select this to have I/O tags attached to the driver hold their last value in the event of a communication failure. If not selected, tags will have their value set to invalid on a communication failure.
External Trigger
Optionally, specify a tag or expression that will cause a fresh read of the URL to be performed.
JSON/XML Driver properties Extra HTTP Headers tab
Some URLs may require extra information such as tokens, form data, etc. Use this tab to specify name=value pairs to be added to the JSON or XML URL. Values may be specified here, or supplied from expressions or tags.
The following widgets are available to display information about your application’s JSON/XML Driver tags: