19:50, EET
June 27, 2012
in my application, I’m going to have multiple custom nodemanagers that will come and go over time. Right now, each one gets a namespaceIndex, and client can communicate with them. What happens if I have three nodemanagers with namespace indices of 2, 3, and 4, and then the middle one goes away? When the device restarts, the nodemanager that was third will be second and get index 3, and clients that were talking to 4 won’t be able to find their data anymore, correct? What is the best way to handle this? I would really prefer to use a name instead of an index. Is there a way to do this?
In the BigNodeManager sample, the code seems to convert NodeId to ExpandedNodeId often. What is the advantage of doing this? Is there somewhere in the code that a NodeId couldn’t be used instead? The two versions of getDataItem seem to use them both in exactly the same way
Why would I want to use an expanded node id instead of a regular one?
11:36, EET
December 21, 2011
Yes, the namespaceIndex may change. So, if you store nodeIds on the client side, you should store the namespaceUri, instead of namespaceIndex. You can map between these, using the NamespaceTable of the server, available from UaClient.getNamespaceTable().
ExpandedNodeIds can use the namespaceUri instead of namespaceIndex. They also enable referring to nodes that point to a node on another server. Therefore some service methods in the UA interface are defined to use ExpandedNodeId instead of NodeId. That’s also why you see them both used in the BigNodeManager example as well.
6:20, EET
March 22, 2013
Jouni Aro said
Yes, the namespaceIndex may change. So, if you store nodeIds on the client side, you should store the namespaceUri, instead of namespaceIndex. You can map between these, using the NamespaceTable of the server, available from UaClient.getNamespaceTable().
ExpandedNodeIds can use the namespaceUri instead of namespaceIndex. They also enable referring to nodes that point to a node on another server. Therefore some service methods in the UA interface are defined to use ExpandedNodeId instead of NodeId. That’s also why you see them both used in the BigNodeManager example as well.
Hi ,
I tried , but I am getting the same uri for all the node ids. For example if node id is ns=3;s=DataItem_0998 , index is 3 then I am getting the uri as http://www.prosysopc.com/OPCUA…..dressSpace . But we need an unique id . Can I accomplish this with uri concept ? Please suggest if I am doing anything wrong.
Thanks in advance.
10:33, EET
December 21, 2011
cto said
Hi ,
I tried , but I am getting the same uri for all the node ids. For example if node id is ns=3;s=DataItem_0998 , index is 3 then I am getting the uri as http://www.prosysopc.com/OPCUA…..dressSpace . But we need an unique id . Can I accomplish this with uri concept ? Please suggest if I am doing anything wrong.
Sorry, but I did not quite understand what you are trying.
The NodeId is composed of the Namespace and an ID. The namespace is usually defined with NamespaceIndex, e.g. 3, which refers to the index of the respective NamespaceUri in the NamespaceArray of the server. The index may change when the server is restarted, so it is not always safe to store NodeIds in the client using the indexes. Instead, you would store the NamespaceUri, e.g. http://www.prosysopc.com/OPCUA…..dressSpace.
The combination of the Namespace and the ID is always unique for the node.
11:41, EET
March 22, 2013
Jouni Aro said
cto said
Hi ,
I tried , but I am getting the same uri for all the node ids. For example if node id is ns=3;s=DataItem_0998 , index is 3 then I am getting the uri as http://www.prosysopc.com/OPCUA…..dressSpace . But we need an unique id . Can I accomplish this with uri concept ? Please suggest if I am doing anything wrong.Sorry, but I did not quite understand what you are trying.
The NodeId is composed of the Namespace and an ID. The namespace is usually defined with NamespaceIndex, e.g. 3, which refers to the index of the respective NamespaceUri in the NamespaceArray of the server. The index may change when the server is restarted, so it is not always safe to store NodeIds in the client using the indexes. Instead, you would store the NamespaceUri, e.g. http://www.prosysopc.com/OPCUA…..dressSpace.
The combination of the Namespace and the ID is always unique for the node.
Thanks got my answer . Now suppose I have the following output .
node id –>> ns=3;s=DataItem_0998 :: name space index —>> 3 :: name space uri —>> http://www.prosysopc.com/OPCUA…..dressSpace
In node id I get that node id = ns=3;s=DataItem_0998 where namespace index is 3 . My concern is that in the node id does the s=DataItem_0998 part is fixed ?
14:47, EET
December 21, 2011
6:10, EET
March 22, 2013
Jouni Aro said
Yes the ID-part is always fixed.
Is it possible that there in the same address space with different name space uri , tag with same id exists ? That is say I have DataItem_0998 against one uri and DataItem_0998 against another in the same address space ? Also is there any provision to know that the OPC UA server has restarted ? If the server restarts when I again connect is there any sdk method to know the node id with input namespace uri and id or I have to browse again and get it ?
12:33, EET
December 21, 2011
Yes, different name spaces may have the same IDs.
You can monitor the server status with UaClient.addServerStatusListener() to get notified of a server shutdown.
If you store the NamespaceUri and ID, you can use that later. You can use UaClient.getNamespaceTable() to convert the NamespaceUri to NamespaceIndex, which you need for NodeId.
Note that in normal circumstances, the namespaces of the server are not expected to change, but it is always possible.
6:18, EET
March 22, 2013
Jouni Aro said
Yes, different name spaces may have the same IDs.
You can monitor the server status with UaClient.addServerStatusListener() to get notified of a server shutdown.
If you store the NamespaceUri and ID, you can use that later. You can use UaClient.getNamespaceTable() to convert the NamespaceUri to NamespaceIndex, which you need for NodeId.
Note that in normal circumstances, the namespaces of the server are not expected to change, but it is always possible.
Thanks. Could you please tell me how the namespace uri is constructed ? Suppose in the address space I have a tag located in the following location .
data–>dataitems–>dataitem1
So is the uri like data.dataitems.dataitem1.I guess it is not like that.
8:41, EET
December 21, 2011
9:14, EET
March 22, 2013
Jouni Aro said
No, there is no generic rule how the NodeID is constructed. You will need to find it out, by browsing or from the documentation of the server.
Thanks , is there a way that I can get the data type information of the tag ? Also another query is there a way so that I browse once and list all the tags in an address space in one go , instead of browsing individually ?
11:59, EET
December 21, 2011
cto said
Thanks , is there a way that I can get the data type information of the tag ?
You can read the DataType attribute. In the SDK, UaVariable.getDataType() and/or getDataTypeId().
Also another query is there a way so that I browse once and list all the tags in an address space in one go , instead of browsing individually ?
No there isn’t. Also when browsing you may get back to nodes that you have already browsed, so beware of infinite loops.
10:35, EET
March 22, 2013
Jouni Aro said
cto said
Thanks , is there a way that I can get the data type information of the tag ?
You can read the DataType attribute. In the SDK, UaVariable.getDataType() and/or getDataTypeId().
Also another query is there a way so that I browse once and list all the tags in an address space in one go , instead of browsing individually ?
No there isn’t. Also when browsing you may get back to nodes that you have already browsed, so beware of infinite loops.
Hi,
Data was continuously getting fetched from OPC UA server , but suddenly the following exception is thrown. Could please explain this one .
02/02/2014 18:25:37.366 INFO [Blocking-Work-Executor-2279] org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp – 318: Error recovery failed, security token has expired
02/02/2014 18:25:37.366 INFO [Blocking-Work-Executor-2279] org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp – 318 Closed
02/02/2014 18:25:37.366 INFO [Blocking-Work-Executor-2279] org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp – -1: Error recovery = false
13:29, EET
December 21, 2011
Hi, it is better to use a New Topic for a new question. I moved your question and answer here
Most Users Ever Online: 1919
Currently Online:
45 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 726
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1525
Posts: 6456
Newest Members:
forrestdilke5, ernestoportus31, martin123, rickie5305, shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rustModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1028, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1