2

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

David
  • 792
  • 5
  • 17

1 Answers1

3

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?

Kevin Herron
  • 6,500
  • 3
  • 26
  • 35
  • Thanks, the first part has already helped to clarify a few things. I've updated my question for the second part. – David Apr 01 '21 at 12:35
  • 1
    There's nothing wrong with that NodeId, it will parse just fine. If you get Bad_NodeIdUnknown in response to a read for that NodeId it means you have the wrong NodeId or there is something wrong with the server. – Kevin Herron Apr 01 '21 at 12:48