Write

A page that uses JSON, JavaScript and HTTP to write data to an OPC UA server.

This page uses JavaScript to construct a JSON write request and HTTPS to POST it to the OPC UA ReferenceServer. The same variables can be written by any OPC UA Client using TCP and the binary data encoding. The parameters in the Write requests and responses are defined here.

The following figure illustrates the interactions between the website and the OPC UA ReferenceServer:

Write Sequence Diagram

Restrictions on cross-site scripting require the web server to forward requests to the HTTP endpoint exposed by the OPC UA ReferenceServer.

A BadUserIdentityToken rejected error will appear if not logged in. The access token is sent to the server as the Authorization header in the HTTP request.

The syntax used to specify NodeIds is defined in Part 6.

Note that this example only allows writes to values that accept numbers as inputs. This was to keep the example as simple as possible.


Node ID
Value
Result