opc-uamilo

Connect to a node with a String identifier


I'm trying to write a generic OPC-UA connector with Eclipse Milo. Reading data from nodes already works fine when I'm using numeric nodeIDs, such as ns=0;i=2258. In milo I can simple construct the nodeID like this for example:

NodeId nodeIdentifier = new NodeId(Unsigned.ushort(nameSpaceID), uint(nodeID));

and it works fine.

But when I'm trying to connect to a note with a string identifier of a production node that only have a string identifier like shown in this image

Screenshot of a node with a string identifier

the process fails with a StatusCode{name=Bad_NodeIdUnknown, value=0x80340000, quality=bad} exception. I create the nodeIdentifier like this NodeId nodeIdentifier = NodeId.parse(nodeIDString);

and the parsed value looked like this:

ns=1;s=t|023_Messwert


Solution

  • First things first, you can’t just decide to use a string-based NodeId because you feel like it. If the server is exposing it as an integer-based NodeId then that’s what you have to use, as is the case with the CurrentTime Node being identified by ns=0;i=2258.

    Parsing a string-based NodeId via NodeId.parse will work fine as long as it’s in the right format. What value are you trying to parse?