Can we have duplicate name in Payload of a NetworkMessage|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
Can we have duplicate name in Payload of a NetworkMessage
Avatar
Karthickperumal Perumal
Member
Members
Forum Posts: 5
Member Since:
04/02/2014
sp_UserOfflineSmall Offline
1
07/20/2021 - 20:23
sp_Permalink sp_Print

Hi All,

I need to send same Tags with different time stamp in a Single Network message.

As specification says, the Payload object is a name-value pair, here the name is a Tag/node name in the Dataset.

Is it valid to have duplicate name with different timestamp in a Network message?

Please share your inputs on this.

Thank you in advance.

https://reference.opcfoundatio.....3/#7.2.3.3

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
07/21/2021 - 12:20
sp_Permalink sp_Print

You can't have duplicate names in JSON payloads because they are a JSON object.

Avatar
Karthickperumal Perumal
Member
Members
Forum Posts: 5
Member Since:
04/02/2014
sp_UserOfflineSmall Offline
3
07/21/2021 - 18:33
sp_Permalink sp_Print

Thank you Randy.

The use case which I am trying to address here is, we have Publisher components which fetch data from the UA Server and sent to Mqtt broker.

So, if the publisher is subscribed to a server monitored item, where Queue size is greater than 1 (Say 5).

For every publishing interval, Publishing response may have 5 values for the monitored item.

How to send all the 5 values received from the server, in the Payload to the Broker.

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
07/22/2021 - 06:34
sp_Permalink sp_Print

Each NetworkMessage can have multiple DataSetMessages.

Create a DataSetMessages for each sampling interval.

Avatar
Karthickperumal Perumal
Member
Members
Forum Posts: 5
Member Since:
04/02/2014
sp_UserOfflineSmall Offline
5
07/25/2021 - 18:54
sp_Permalink sp_Print

Hi Randy,

Thanks for your Inputs. 

So i created multiple DatasetMessage for a Tag/Item for every Sampling Interval. The Network Message looks as given below:

{"MessageId":"1287f24d-8229-4580-874f-0eaf142526f9","MessageType":"ua-data","PublisherId":"Publisher","DataSetClassId":"6a4379ac-0adb-4000-8b7e-b57eaca01826",
"Messages":{"DataSetWriterId":1,"SequenceNumber":15,"MetaDataVersion":{"MajorVersion":1,"MinorVersion":1},"Payload":{"DataSetId":{"Value":{"Type":12,"Body":"DataSetId#01"},"SourceTimestamp":"2021-07-26T01:30:40.1811213Z","ServerTimestamp":"2021-07-26T01:30:40.181122Z"},"NS4|Numeric|1003":{"Value":{"Type":4,"Body":9},"SourceTimestamp":"2021-07-26T01:29:56.4537117Z","ServerTimestamp":"2021-07-26T01:29:56.5847112Z"}}},
"Messages":{"DataSetWriterId":1,"SequenceNumber":16,"MetaDataVersion":{"MajorVersion":1,"MinorVersion":1},"Payload":{"NS4|Numeric|1003":{"Value":{"Type":4,"Body":10},"SourceTimestamp":"2021-07-26T01:29:59.0757308Z","ServerTimestamp":"2021-07-26T01:29:59.184747Z"}}},
"Messages":{"DataSetWriterId":1,"SequenceNumber":17,"MetaDataVersion":{"MajorVersion":1,"MinorVersion":1},"Payload":{"NS4|Numeric|1003":{"Value":{"Type":4,"Body":11},"SourceTimestamp":"2021-07-26T01:30:01.3107239Z","ServerTimestamp":"2021-07-26T01:30:01.3847107Z"}}}}

The problem here is, the  JSON validator is failing, with Error "Duplicate key 'Messages'.

Any inputs on this?

Thank you.

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
07/25/2021 - 19:26
sp_Permalink sp_Print

Make sure the message complies with:

https://reference.opcfoundatio.....t14/7.2.3/

Should be a JSON array not a JSON object.

Avatar
Zbynek Zahradnik
Member
Members
Forum Posts: 62
Member Since:
02/24/2014
sp_UserOfflineSmall Offline
7
07/25/2021 - 21:59
sp_Permalink sp_Print

Here is (my) tool that will show you how the possible formats should look like: OPC UA PubSub Formatter, https://kb.opclabs.com/Tool_Do....._Formatter .

Best regards

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 29
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855