I have created 3 custom structure DataTypes and trying to read the value as mentioned above.
By reading objects I mean, I have created node in address space and trying to read the node from address space. node is type of Test DataType.
While reading node in Value attribute I have testData but in testData I can only see parent field not child field, but I have assigned Child type so client should be able to decode it correctly.
Please let me know If any other information I can provide
If I understand the topic, this is the scenario:
- TestParentStructure testData;
- Int32 parent1;
- Double child1;
- During runtime instantiation, if testData == an instance of TestChildStructure, then how DOES the client know it?
@Rahul, I guess this is what your question is.
Client decode the ExtentionObject using encoding id but how client will know the encoding id of Fields. I didn't find anything on UA Specs related to this if Fields are also ExtentionObject. How should server encode the data so that Client will know the actual type of Fields.
I have checked couple of OpcUa Clients that are decoding the extention object based on encoding id and after getting actual type of ExtentionObject, Fields are decoded based on DataTypes. This can be wrong in the situation where fields are storing subtypes as in my case.
If there is any documentation or reference for this situation please let me know.
The UABinary encoding is defined completely here:
It explains that each field in a structure is encoded using the encoding for the datatype.
It also explains that embedded structures are encoded directly with no type id.
That said, if the DataType of the field has the AllowSubtypes flag set then the Structure is encoded as a ExtensionObject.