-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataType Encoding: xml_importer._get_sdef() wrongly assumes, that the first HasEncoding reference represents the default encoding. #1536
Comments
As we currently only support binary, we could just set it to binary by default. |
Good point, however since the nodes representing encoding like "Default Binary" are created for each and every data-type individually (for whatever reason..), you still have to search for the individual target node with this browse_name/display_name. |
That import is already slow, I am really afraid of what is going to happen if we have to do a second pass... |
I just stepped through some code to get a better understanding:
IMHO a lot of things could go wrong in trying to adjust the DefaultEncodingId afterwards.. Since I'm not an expert in this project: |
For those of you looking for a companion specification where the error occurs: |
During parsing a node-set, StuctureDefinition objects are created for sub-data-types of data-type Structure.
Important information of a structure definition are the supported encodings (Binary, XML. JSON) and the proposed default encoding.
OPC UA Part 3 8.48 StructureDefinition defines the DefaultEncodingId as follows:
However, the current implementation wrongly assumes, that the first HasEncoding reference of the data-type node represents the default encoding, see snippet:
Since some existing "real world" companion specifications to not sort the HasEncoding references in the node-set with "Default Binary" on top (and are not mandated to do so), the wrong assumption causes runtime errors when trying to transfer such data between client and server.
In order to determine the correct DefaultNodeId, additional data of the references' target nodes is required (browse_name, display_name). As far as I understand, this data does not exist within the context of the _get_sdef() method. Imho this would either require following the references' targets within the scope of the method or doing a second pass.
Please consider additional issues in the context of handling HasEncoding e.g., xmlimporter.add_object(): Exclusion of HasEncoding target objects sometimes fails for 'Default JSON'.
The text was updated successfully, but these errors were encountered: