The following DataSets are used for the following JSON message examples.

Table A.13 shows the field for example DataSet1.

Table A.13 – DataSet1 fields

Field Name

DataType

ValueRank

Active

Boolean

Scalar

Temperature

Double

Scalar

Counter

UInt32

Scalar

AdditionalInfo

String

Scalar

Table A.14 shows the field for example DataSet2.

Table A.14 – DataSet2 fields

Field Name

DataType

ValueRank

LocationName

String

Scalar

Coordinate

MyStruct

Scalar

X

Float

Scalar

Y

Float

Scalar

Measurements

Int32

Array

Table A.15 shows the field for example DataSet3.

Table A.15 – DataSet3 fields

Field Name

DataType

ValueRank

BooleanValue

Boolean

Scalar

Int32Value

Int32

Scalar

Int64Value

Int64

Scalar

UInt32Value

UInt32

Scalar

UInt64Value

UInt64

Scalar

DoubleValue

Double

Scalar

DateTimeValue

DateTime

Scalar

StringValue

String

Scalar

GuidValue

Guid

Scalar

StatusCodeValue

StatusCode

Scalar

LocalizedTextValue

LocalizedText

Scalar

ByteStringValue

ByteString

Scalar

NodeIdValue

NodeId

Scalar

QualifiedNameValue

QualifiedName

Scalar

The following example shows the DataSetMetaData message for DataSet1.

{

"MessageId": "66D65CA4-92EE-4195-9867-E6E27794B692",

"MessageType": "ua-metadata",

"PublisherId": "MyPublisher",

"DataSetWriterId": 101,

"MetaData": {

"Fields": [

{

"Name": "Active",

"FieldFlags": 0,

"BuiltInType": 1,

"DataType": {"Id": 1},

"ValueRank": -1,

"MaxStringLength": 0,

"DataSetFieldId": "f355bfe8-d5c0-4073-aa89-c8d9d9f8c0c4"

},

{

"Name": "Temperature",

"FieldFlags": 0,

"BuiltInType": 11,

"DataType": {"Id": 11},

"ValueRank": -1,

"MaxStringLength": 0,

"DataSetFieldId": "4b91e1cc-61f5-411a-9fb3-ea9087d2154c"

},

{

"Name": "Counter",

"FieldFlags": 0,

"BuiltInType": 7,

"DataType": {"Id": 7},

"ValueRank": -1,

"MaxStringLength": 0,

"DataSetFieldId": "885d0b3b-8a83-41ae-882a-3a528041140f"

},

{

"Name": "AdditionalInfo",

"FieldFlags": 0,

"BuiltInType": 12,

"DataType": {"Id": 12},

"ValueRank": -1,

"MaxStringLength": 0,

"DataSetFieldId": "b020c4a8-c427-4d33-83ea-b0f437a9c6ea"

}

],

"DataSetClassId": "e95258a4-0b50-41b0-9f37-505e90565584",

"ConfigurationVersion": {

"MajorVersion": 672338910,

"MinorVersion": 672341762

}

},

"DataSetWriterName": "Writer101"

}

The following example shows the DataSetMetaData message for DataSet2.

{

"MessageId": "66D65CA4-92EE-4195-9867-E6E27794B692",

"MessageType": "ua-metadata",

"PublisherId": "MyPublisher",

"DataSetWriterId": 102,

"MetaData": {

"Namespaces": [

"urn:DEMO-5:UA Sample Server",

"http://test.org/UA/Data/"

],

"StructureDataTypes": [

{

"DataTypeId": {"IdType": 1, "Id": "CoordinateDataType", "Namespace": 2},

"Name": {"Name": "CoordinateDataType", "Uri": 2},

"StructureDefinition": {

"DefaultEncodingId": {"Id": 24351, "Namespace": 2},

"BaseDataType": {"Id": 22},

"StructureType": 0,

"Fields": [

{

"Name": "X",

"Description": {"Text": "The X coordinate."},

"DataType": {"Id": 10},

"ValueRank": -1,

"MaxStringLength": 0,

"IsOptional": false

},

{

"Name": "Y",

"Description": {"Text": "The Y coordinate."},

"DataType": {"Id": 10},

"ValueRank": -1,

"MaxStringLength": 0,

"IsOptional": false

}

]

}

}

],

"Fields": [

{

"Name": "LocationName",

"FieldFlags": 0,

"BuiltInType": 12,

"DataType": {"Id": 12},

"ValueRank": -1,

"MaxStringLength": 0,

"DataSetFieldId": "8968e376-e281-47bf-b621-e1fb710c8954"

},

{

"Name": "Coordinate",

"FieldFlags": 0,

"BuiltInType": 22,

"DataType": {

"IdType": 1,

"Id": "CoordinateDataType",

"Namespace": 2

},

"ValueRank": -1,

"MaxStringLength": 0,

"DataSetFieldId": "4a1a1f3c-76c0-46ac-92bd-b02bfbe59dcf"

},

{

"Name": "Measurements",

"FieldFlags": 0,

"BuiltInType": 6,

"DataType": {"Id": 6},

"ValueRank": 1,

"MaxStringLength": 0,

"DataSetFieldId": "7d177014-32de-421e-a0a3-bc48ede8ac9d"

}

],

"DataSetClassId": "4f457b18-32f8-48a5-a6f0-18ae5ebdc7f4",

"ConfigurationVersion": {"MajorVersion": 672338910, "MinorVersion": 672341762}

},

"DataSetWriterName": "Writer102"

}

One of the use cases for PubSub is the publication of data to IT applications through a topic or message queue where the IT application does not have any knowledge about OPC UA. In such a use case, the messages that are sent to the message queue can only contain one DataSetMessage and there should be no OPC UA specific information or header.

The header layout described in this section is optimized for this use case.

A minimal message has the following settings:

The header layout URI for the mimimal layout as specified in A.3.2.4 is

http://opcfoundation.org/UA/PubSub-Layouts/JSON-Minimal

Table A.16 defines the values for the WriterGroup configuration parameters representing this layout.

Table A.16 – Values for WriterGroup configuration parameters

Parameter

Value

JsonNetworkMessageContentMask

0x00000004

This value results of the following options:

Bit 0: NetworkMessageHeader = 0

Bit 1: DataSetMessageHeader = 0

Bit 2: SingleDataSetMessage = 1

Bit 3: PublisherId = 0

Bit 4: DataSetClassId = 0

Bit 5: ReplyTo = 0

Bit 6: WriterGroupName = 0

Table A.17 defines the values for the DataSetWriter configuration parameters representing this layout.

Table A.17 – Values for DataSetWriter configuration parameters

Parameter

Value

JsonDataSetMessageContentMask

0x0

This value results of the following options:

Bit 0: DataSetWriterId = 0

Bit 1: MetaDataVersion = 0

Bit 2: SequenceNumber = 0

Bit 3: Timestamp = 0

Bit 4: Status = 0

Bit 5: MessageType = 0

Bit 6: DataSetWriterName = 0

Bit 7: ReversibleFieldEncoding = 0

Bit 8: PublisherId = 0

Bit 9: WriterGroupName = 0

Bit 10: MinorVersion = 0

DataSetFieldContentMask

0

KeyFrameCount

configurable

Example for DataSet1.

{

"Active":true,

"Temperature":25.5,

"Counter":0,

"AdditionalInfo":"The system is running normally (1)"

}

Example for DataSet2.

{

"LocationName":"Building A",

"Coordinate":

{

"X":0,

"Y":0.2

},

"Measurements":

[

20030,

20020,

20010

]

}

Example for DataSet3.

{

"BooleanValue":false,

"Int32Value":0,

"Int64Value":"1",

"UInt32Value":1,

"UInt64Value":"1",

"DoubleValue":0.5,

"DateTimeValue":"2021-09-14T07:14:30Z",

"StringValue":"String 1",

"GuidValue":"ebfc352a-3142-4b99-9bbe-89a517d6a77e",

"StatusCodeValue":

{

"Code":2147483648,

"Symbol":"Bad"

},

"LocalizedTextValue":"Localized text 1",

"ByteStringValue":"AAEC",

"NodeIdValue":

{

"IdType":1,

"Id":"Boilers.Boiler #1.PipeX001.ValveX001.Input",

"Namespace":"http://test.org/UA/Data/Instance"

},

"QualifiedNameValue":

{

"Name":"PipeX001",

"Uri":"http://test.org/UA/Data/"

}

}

One of the use cases for PubSub is the publication of data to IT applications through a message queue where one DataSet is related to one message queue.

The IT application does not need to have knowledge about OPC UA but OPC UA specific header may be used for the message processing.

In such a use cases, the messages sent to a message queue can only contain one DataSetMessage but a OPC UA specific header is provided.

The header layout described in this section is optimized for this use case.

A single DataSet message has the following settings:

The header layout URI for the single DataSetMessage layout as specified in A.3.3.4 is

http://opcfoundation.org/UA/PubSub-Layouts/JSON-DataSetMessage

Table A.18 defines the values for the WriterGroup configuration parameters representing this layout.

Table A.18 – Values for WriterGroup configuration parameters

Parameter

Value

JsonNetworkMessageContentMask

0x00000006

This value results of the following options:

Bit 0: NetworkMessageHeader = 0

Bit 1: DataSetMessageHeader = 1

Bit 2: SingleDataSetMessage = 1

Bit 3: PublisherId = 0

Bit 4: DataSetClassId = 0

Bit 5: ReplyTo = 0

Bit 6: WriterGroupName = 0

Table A.19 defines the values for the DataSetWriter configuration parameters representing this layout.

Table A.19 – Values for DataSetWriter configuration parameters

Parameter

Value

JsonDataSetMessageContentMask

The mask allows the following options:

Bit 0: DataSetWriterId = 1

Bit 1: MetaDataVersion = 0

Bit 2: SequenceNumber = 1

Bit 3: Timestamp = 1

Bit 4: Status = 1

Bit 5: MessageType configurable (default is 0)

Bit 6: DataSetWriterName configurable (default is 0)

Bit 7: ReversibleFieldEncoding = 0

Bit 8: PublisherId = 1

Bit 9: WriterGroupName configurable (default is 0)

Bit 10: MinorVersion = 1

DataSetFieldContentMask

configurable (default is 0)

KeyFrameCount

configurable

If the KeyFrameCount is not 1, the MessageType bit shall be true.

Example for DataSet1 with all configurable JsonDataSetMessageContentMask flags set to false and no flags set for DataSetFieldContentMask.

{

"PublisherId":"MyPublisher",

"DataSetWriterId":101,

"SequenceNumber":68468,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Payload":

{

"Active":true,

"Temperature":25.5,

"Counter":0,

"AdditionalInfo":"The system is running normally (1)"

}

}

Example for DataSet2 with all configurable JsonDataSetMessageContentMask flags set to true and no flags set for DataSetFieldContentMask.

{

"PublisherId":"MyPublisher",

"DataSetWriterId":102,

"SequenceNumber":25460,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Status":1073741824,

"MessageType":"ua-keyframe",

"WriterGroupName":"WriterGroup1",

"DataSetWriterName":"Writer102",

"Payload":

{

"LocationName":"Building A",

"Coordinate":

{

"X":1,

"Y":0.2

},

"Measurements":

[

20030,

20020,

20010

]

}

}

Example for DataSet1 with all configurable JsonDataSetMessageContentMask flags set to false and with SourceTimestamp and StatusCode flags set in the DataSetFieldContentMask. The Status is omitted if the Code is 0.

{

"PublisherId":"MyPublisher",

"DataSetWriterId":101,

"SequenceNumber":68468,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Payload":

{

"Active":

{

"Value":true,

"Status":{"Code":1073741824,"Symbol":"Uncertain"},

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

},

"Temperature":

{

"Value":25.5,

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

},

"Counter":

{

"Value":0,

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

},

"AdditionalInfo":

{

"Value":"The system is running normally (1)",

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

}

}

}

One of the use cases is streaming of multiple different data and event DataSets through a single message queue for further processing in cloud applications.

The header layout described in this section is optimized for this use case.

A minimal message has the following settings:

The header layout URI for the multiple DataSetMessages layout as specified in A.3.4.4 is

http://opcfoundation.org/UA/PubSub-Layouts/JSON-NetworkMessage

Table A.20 defines the values for the WriterGroup configuration parameters representing this layout.

Table A.20 – Values for WriterGroup configuration parameters

Parameter

Value

JsonNetworkMessageContentMask

The mask allows the following options:

Bit 0: NetworkMessageHeader = 1

Bit 1: DataSetMessageHeader = 1

Bit 2: SingleDataSetMessage = 0

Bit 3: PublisherId enabled

Bit 4: DataSetClassId configurable (default is 0)

Bit 5: ReplyTo configurable (default is 0)

Bit 6: WriterGroupName configurable (default is 0)

Table A.21 defines the values for the DataSetWriter configuration parameters representing this layout.

Table A.21 – Values for DataSetWriter configuration parameters

Parameter

Value

JsonDataSetMessageContentMask

The mask allows the following options:

Bit 0: DataSetWriterId = 1

Bit 1: MetaDataVersion = 0

Bit 2: SequenceNumber = 1

Bit 3: Timestamp = 1

Bit 4: Status = 1

Bit 5: MessageType configurable (default is 0)

Bit 6: DataSetWriterName configurable (default is 0)

Bit 7: ReversibleFieldEncoding = 0

Bit 8: PublisherId = 0

Bit 9: WriterGroupName configurable (default is 0)

Bit 10: MinorVersion = 1

DataSetFieldContentMask

configurable (default is 0)

KeyFrameCount

configurable

If the KeyFrameCount is not 1, the MessageType bit shall be true.

Example for DataSet1, DataSet2 and DataSet3 with all configurable JsonNetworkMessageContentMask and JsonDataSetMessageContentMask flags set to false and no flags set for DataSetFieldContentMask.

{

"MessageId":"9279c0b3-da88-45a4-af74-451cebf82db0",

"MessageType":"ua-data",

"PublisherId":"MyPublisher",

"Messages":

[

{

"DataSetWriterId":101,

"SequenceNumber":68468,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Payload":

{

"Active":true,

"Temperature":25.5,

"Counter":0,

"AdditionalInfo":"The system is running normally (1)"

}

},

{

"DataSetWriterId":102,

"SequenceNumber":25460,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Status":1073741824,

"Payload":

{

"LocationName":"Building A",

"Coordinate":{"X":0,"Y":0.2},

"Measurements":[20030,20020,20010]

}

},

{

"DataSetWriterId":103,

"SequenceNumber":66915,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Payload":

{

"BooleanValue":false,

"Int32Value":0,

"Int64Value":"1",

"UInt32Value":1,

"UInt64Value":"1",

"DoubleValue":0.5,

"DateTimeValue":"2021-09-14T07:14:30Z",

"StringValue":"String 1",

"GuidValue":"ebfc352a-3142-4b99-9bbe-89a517d6a77e",

"StatusCodeValue":

{

"Code":2147483648,

"Symbol":"Bad"

},

"LocalizedTextValue":"Localized text 1",

"ByteStringValue":"AAEC",

"NodeIdValue":

{

"IdType":1,

"Id":"Boilers.Boiler #1.PipeX001.ValveX001.Input",

"Namespace":"http://test.org/UA/Data/Instance"

},

"QualifiedNameValue":

{

"Name":"PipeX001",

"Uri":"http://test.org/UA/Data/"

}

}

}

]

}