Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
UA & Classic SDK: A couple of questions
August 24, 2022
18:29, EEST
Guido Niewerth
Forum Posts: 8
Member Since:
August 23, 2022
sp_UserOfflineSmall Offline


I´m currently evaluating the OPC UA & Classic SDK for Delphi v7.5.0 Build 802 using the Embarcadero RAD Studio 10.1 Berlin.
I managed to run a sample OPC UA server, but I have a couple of questions:

– is the “Opc.Ua.NodeSet2.xml” file mandatory? The application throws an exception when I prevent it from loading that file. As far as I understood its content defines the Namespace 0.

– I cannot create a folder in my own namespace. When I call the “CreateFolder” method on my node manager it throws an exception (“NodeFactory: No type definition registered for type: TUaFolderType.”. This is how I call the method:
TUaServer* srv = new TUaServer();
// lots of initialisation
TUaNodeManagerUaNode* mgr = new TUaNodeManagerUaNode();
mgr->Server = srv;
mgr->Namespace = TUaNamespace::Get( “http://mycompany.com” );
srv->AddNodeManager( mgr );

TUaFolderType* folder = mgr->CreateFolder( “Folder1” ); << throws the exception

– how do I search for a node by Name? I need to create a device node by calling "CreateObject()" on the node manager, but if I call the function again with the same name the application throws an exception because there is already a device with that name. I searched the HTML and CodeInsight help for a method that allows me to find a node by its name, or even a list of nodes so I can find it myself, but there seems to be no such functionality, at least none to search by name.

– how do I find the namespace details for a given namespace id? When looking at the variables provided by my OPC UA server with an OPC UA client, the node Ids read "ns=2,s=Variable 1". How do I get the namespace information for namespace with index 2?

Kind regards,

August 25, 2022
18:24, EEST
Jouni Aro
Forum Posts: 960
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi, thanks for giving Prosys Sentrol a try and thanks for asking for clarifications.

– Opc.Ua.NodeSet2.xml is definitely mandatory for the server – that’s where it initialises the compulsory contents of the standard namespace that every server must support.

– Your problem with CreateFolder is strange. Can you start the UaCppSampleServer in the SDK samples? It is using the same method and works fine for me.

– Unfortunately there is no way to search nodes by their Name so far. But in fact, the Name doesn’t need to be unique. By default, ‘CreateObject’ actually uses the Name also for the NodeId – and the NodeId must be unique. And you can search for nodes by the NodeId using ‘NodeManager.getNode()’. You can also provide a custom NodeId for ‘CreateObject’ to ensure yourself that they are unique.

– You can use UaServer.NamespaceTable.Namespaces[2] on the server side – or UaClient.NamespaceTable.Namespaces[2] on the client side. Note that we try to avoid using the index within the SDK, since the index is relative and therefore it is better to check the equality using the Namespace object or it’s NamespaceURI instead. But, maybe that’s what you were already after.

And in fact, if you have a TUaNodeId, you will find the Namespace directly from it without going back to the NamespaceTable.

BTW: Make sure you read the OPC UA tutorials for the SDK. They also try to explain these concepts.

August 25, 2022
18:41, EEST
Guido Niewerth
Forum Posts: 8
Member Since:
August 23, 2022
sp_UserOfflineSmall Offline

Thanks for your answer, Jouni.

I played around a bit and some things are now clear to me.
I wrapped my own class around TUaServer and added some comfort functions which manage namespaces, variables, devices and folders. Instead of using the built-in functions I implemented my own and almost all my issues are solved.

The reason for CreateFolder bug was I called it before initializing the server and the default namespace. I make the CreateFolder call after initializing the TUaServer object it works fine.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 124

pramanj: 86

ibrahim: 74

rocket science: 65

kapsl: 57

Sabari: 51

gjevremovic: 49

Xavier: 43

fred: 41

TimK: 41

Member Stats:

Guest Posters: 0

Members: 1749

Moderators: 15

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1323

Posts: 5649

Newest Members:

WalterFOUNC, datafastproxiespx01, LenkaLok, seoninet, justinevillanuev, namtrott5457, DonaldWibip, AlfredoEthix, andreidla, everangel7021

Moderators: Jouni Aro: 960, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 860, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 25, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 222, Lusetti: 0

Administrators: admin: 1