OPC UA Server
Connectware can act as an OPC UA server, exposing data to OPC UA clients. For OPC UA client functionality, see OPC UA Client.
Configuration
Define a server resource of type Cybus::Server::Opcua in your service commissioning file. OPC UA clients can connect to this server using:
opc.tcp://<connectwareHost>:4841<resourcePath>
Connectware uses port 4841 instead of the standard OPC UA port 4840 to avoid conflicts with other OPC UA servers. Only one OPC UA server instance can run per Connectware installation.
If Connectware is accessible via DNS hostname, specify this hostname in the hostname property to allow connections from outside the Docker network. Do not use localhost as it only refers to the local container.
The resourcePath property defines the connection string prefix and defaults to /UA/CybusOpcuaServer. This path must be included in the connection URL for clients to connect successfully.
Node Structure
Define data points as Cybus::Node::Opcua resources. Nodes form a tree hierarchy:
One root node with its
parentproperty referencing the server.All other nodes reference the root node or intermediate nodes as
parent.
Nodes can be defined in the same service as the server or in separate services using service-id references. This allows adding or removing nodes dynamically by commissioning additional services.
Security Settings
For production environments, only use the SignAndEncrypt security profile. Other profiles allow communication to be intercepted or manipulated. By default, the OPC UA server only permits SignAndEncrypt connections (configured in securityModes).
Authenticate using Connectware username and password credentials via user token.
Properties Reference
Service Commissioning File Example
Output Format
If the server receives data from an external OPC UA client, the output on the internal MQTT broker will be provided as JSON object:
Input Format
If the server should provide data to an external OPC UA client, the message on the internal MQTT broker must be published in this format:
Note: If 64-bit integers are being used (which are unsupported in JSON, but are supported in Javascript by the BigInt class), the value must be given as a string that contains the decimal number.
OPC UA Method Implementation
OPC UA methods can only be implemented on servers when used in conjunction with FlowSync.
When configured in transaction mode, Cybus::Nodes handle operations differently than standard variable nodes. Any node with the setting operation: transaction follows this workflow:
Publishes request data to the
/treqtopic.Waits to receive a response on the
/trestopic before proceeding.
Example
The following example configuration is taken from FlowSync Example 6.
Request Data Structure
When a method is called, it publishes request details to the /treq topic in the following format:
Each request contains a unique
idfor tracking.The response must include this same
idto complete the flow.
This approach ensures proper request-response pairing and flow completion.
Example
The data structure matches the format shown in FlowSync Example 6.
Response Data Format
Each method call must receive a corresponding response published to the /res topic.
Example
In the FlowSync Example 6, the response will look like this:
Error Response Format
To return an error response from a node, you must include an error property containing the appropriate error code. This code will be used in the method call response. Note that any error.message provided will be ignored.
Example
Last updated
Was this helpful?

