A XML structure is used, for example, in MS Excel and MS Word file formats.
A XML data structure can be transferred in a text file (.xml is the usual extension).
In the context of NETIO products
NETIO products use a XML structure for reading and writing as one of the REST APIs. This API can be regarded as a transfer of the netio.xml text file over http(s) in either direction. Reading (downloading) the file serves to determine the device status and obtain the measured values. By writing (uploading) the file, output states can be changed. It is not necessary to transfer the entire structure; to switch a single output, it is sufficient to transfer just one group of tags.
Username and password (for reading or for reading+writing) is passed in the standard http (or https) header. Therefore, passwords are not contained in the netio.xml file.
XML over HTTP(s) is one of the preferred REST API protocols because it is built on top of http. M2M API protocols based on http tend to be the most reliable with respect to enterprise IT environments, security mechanisms, blocked ports etc.
How the NETIO XML protocol works
-
The device state (sockets ON/OFF + electricity consumption) can be read as the http:// device-IP/netio.xml file at the device’s IP address. The netio.xml file can be downloaded and the contained data structure displayed using a web browser.
-
Outputs are controlled over the XML protocol by uploading the netio.xml file to the device using http(s) post.
- To try out the XML API, end users can utilize various tools and utilities (such as cURL). For testing the XML M2M API, NETIO users can take advantage of the HTTP(s) file upload tool in the web interface. For a detailed description, see AN20.
Integration using XML M2M API
In professional integration, XML data are sent as a data stream with the /netio.xml access point, instead of transferring text files. In the NETIO implementation of the REST XML protocol, the same TCP/IP connection to the http server in the device can be used to write to the device and then read the updated output states.
Sample XML object for controlling an output:
<set:Root xmlns:set="http://www.netio-products.com/XMLSchema/NETIO.xsd">
<Outputs>
<Output>
<ID>1</ID>
<State>1</State>
<Action>6</Action>
</Output>
</Outputs>
</set:Root>
M2M Active Client
Some NETIO products are capable of running Lua scripts in the device. A Lua script can behave as a client that downloads files and controls the communication. This special mode can be used to transfer data in a XML structure. For details, see M2M Active Client.
HTTP or HTTPs?
Some NETIO devices supports even HTTPs layer. But NETIO unified Open API (compatible with all NETIO devices) supports only HTTP version.
Protocol specifications and links
>> NETIO specification of the XML over HTTP(s) protocol: Download page
>> AN20 XML HTTP(s) protocol to control NETIO smart power sockets 110/230V (moved under Standard M2M)