![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/userdefault.png)
10/18/2019
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
Hello,
I have an OPC UA Server which is running and has few complex data types.
I am trying to use the OPC UA Client from Node JS - https://github.com/node-opcua/.....cua-sample and trying to read an extension object.
I have also referred to the NodeJS Handbook - node-opcuabyexample.pdf and the example says, to parse the Extension Object, it says just do the following: console.log(dataValue.toString());
But, when I try to do that, I get the following output for one of the structures:
New Value = { /* DataValue */
value: Variant(Array<ExtensionObject>, l= 2, value=[/* OpaqueStructure */ {
nodeId ns=1;i=5017
buffer =
00000000: 03 00 00 00 56 49 4e 08 00 00 00 45 59 58 31 32 34 35 36 ....VIN....EYX12456
},/* OpaqueStructure */ {
nodeId ns=1;i=5017
buffer =
00000000: 0d 00 00 00 53 4f 43 4b 45 54 5f 4e 55 4d 42 45 52 01 00 00 00 33 ....SOCKET_NUMBER....3
}])
statusCode: Good (0x00000)
serverTimestamp: 2022-01-04T09:35:12.501Z $ 526.000.000
sourceTimestamp: 1601-01-01T00:00:00.000Z $ 000.000.000
}
Â
How DO I parse extension objects so that I can map respective values correctly. Currently the output is in the binary form but the NodeJS example does NOT any details on parsing the structure field accordingly.
Can anyone who has knowledge on NodeJS help us in parsing the structure correctly and getting the required values in the NodeJS Client?
![Avatar](https://opcfoundation.org/wp-content/uploads/sp-resources/forum-avatars/defaults/admindefault.png)
05/30/2017
![sp_UserOfflineSmall](https://opcfoundation.org/wp-content/sp-resources/forum-themes/reboot/images/darkpack/sp_UserOfflineSmall.png)
node-opcua must have code to parse UA binary data. You need to find those APIs and use them to manually decode the ExtensionObject body.
That said. you will need to get the DataTypeDefinition for the type "ns=1;i=5017". The server exposes it in the DataTypeDictionary or in the DataTypeDefinition Attribute.
You should post on the node-opcua since they should have more detailed knowledge of the APIs available.
1 Guest(s)