How to Find / FetchNode a node by BrowseName (IdType String)? [Question] | OPC UA Implementation: Stacks, Tools, and Samples | Forum

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
How to Find / FetchNode a node by BrowseName (IdType String)? [Question]
Avatar
Rudolf
Slovakia
Member
Members
Forum Posts: 19
Member Since:
07/13/2018
sp_UserOfflineSmall Offline
1
03/29/2020 - 08:29
sp_Permalink sp_Print

Hello,

I am trying to list namespaces of my OPC UA server, but without success. I tried also:

If I try this:

NodeId nodeId = new NodeId("Server", 0);

INode node = clientInterface.session.NodeCache.FetchNode(nodeId);

I get an error:

Opc.Ua.ServiceResultException: 'BadNodeIdUnknown'

call

NodeId nodeId = new NodeId(2253, 0);

works fine.

What is the most straightforward way to use browsename to find/fetch node?

Thanks a lot.

Avatar
Randy Armstrong
Admin
Forum Posts: 495
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
03/29/2020 - 11:14
sp_Permalink sp_Print sp_EditHistory

Use the constants defined for well known nodes.

i.e.

var nodeId = new NodeId(Opc.Ua.Objects.Server, 0);

or

var nodeId = Opc.Ua.ObjectIds.Server;

Avatar
Rudolf
Slovakia
Member
Members
Forum Posts: 19
Member Since:
07/13/2018
sp_UserOfflineSmall Offline
3
03/29/2020 - 11:19
sp_Permalink sp_Print

Hi Randy,

thank you for a quick answer. The "Server" was an example to be sure that the nodeid string is correct.

My intention is to get NodeId for Sever.NamespaceArray, or any other node.

Avatar
Randy Armstrong
Admin
Forum Posts: 495
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
03/30/2020 - 01:20
sp_Permalink sp_Print

Constants exist for every UA defined NodeId.

Look in the file to find what you need.

Avatar
Rudolf
Slovakia
Member
Members
Forum Posts: 19
Member Since:
07/13/2018
sp_UserOfflineSmall Offline
5
03/30/2020 - 03:18
sp_Permalink sp_Print

That's correct.

The background of my question: I am trying to build aggregating server. A default ua client do not have a knowledge about the file where node id are defined.

I could generate address space where I set node IDs as strings. But that is just a workaround for specific server.

For requesting node by string ID is a built in function, or it is required by design to use translateBrowsePathsToNodeIds service to access node by its browsename and nemespace index?

Thank you

Rudo

Avatar
Randy Armstrong
Admin
Forum Posts: 495
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
6
03/30/2020 - 17:47
sp_Permalink sp_Print

How a client gets the NodeId is up to the client and depends on the context.

Options include:

1) Browse;
2) TranslateBrowsePath;
3) Read (e.g. DataType Attribute);

You can also save a previously browsed NodeId and load it from configuration file.

All of these work for an aggregating server.

Avatar
Rudolf
Slovakia
Member
Members
Forum Posts: 19
Member Since:
07/13/2018
sp_UserOfflineSmall Offline
7
03/31/2020 - 01:28
sp_Permalink sp_Print

Ok, clear. Thank you

Forum Timezone: America/Phoenix
Most Users Ever Online: 202
Currently Online:
Guest(s) 13
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 9
Topics: 771
Posts: 2275