FreeOpcUa/opcua-asyncio

ExtensionObjects with String TypeIds

Opened this issue · 0 comments

Description

I'm working with a nodeset generated by CODESYS for a PLC, which has been causing several issues. While most seem to stem from the CODESYS side, one issue appears to be an unnecessary limitation in the Asyncua library itself. Specifically, the nodeset generated uses string-based identifiers for ExtensionObjects, as shown in the abbreviated XML example below. When exporting the nodeset to XML, the check for integer identifiers in xmlexporter.py/_value_to_etree() raises an UaInvalidParameterError:

  <UAVariable/>
    <DisplayName/>
    <Description/>
    <References/>
    <Value>
      <uax:ExtensionObject>
        <uax:TypeId>
          <uax:Identifier>ns=3;s=|type|My_String_Identifier</uax:Identifier>
        </uax:TypeId>
        <uax:Body/>
      </uax:ExtensionObject>
    </Value>
  </UAVariable>

From UA Part 6: Mappings (V. 1.05.03) / section 5.2.2.15:

"Server implementers should use namespace-qualified numeric NodeIds for any DataTypeEncoding Objects they define. This will minimize the overhead introduced by packing Structured DataType values into an ExtensionObject."

My understanding of this part of the standard is that it recommends—but does not strictly require—the use of numeric NodeIds for ExtensionObjects. The standard only mandates numeric identifiers explicitly for ExtensionObjects in the UA namespace (section 5.2.2.15). Currently, my nodeset exports correctly if I disable the numeric identifier check.

To Reproduce

Unfortunately I can't provide the complete nodeset, but any ExtensionObject with a String TypeId should trigger the behavior.

Expected behavior

Allow String IDs for types of Extension objects.

Screenshots

image
UAExpert doesn't have any problems with String IDs for types of ExtensionObjects

Versions

Python-Version: 3.12.3

opcua-asyncio Version: 1.1.5 (installed via Anaconda)