Topic RSS20:15, EEST
June 21, 2017
OfflineHi Team,
We aare facing one issue while reading node name from the kepware ua server. With Browse name there is (en) getting appended with name and with display name “2:” getting appended with the tag name.
Please see the code below and its corresponding value:
NodeId nodeId=new NodeId(2, “Channel1.Device1.TestDevice1”);
String displayName = client.readAttribute(nodeId, Attributes.BrowseName).getValue().toString();
Output :2:TestDevice1
With following code:String displayName = client.readAttribute(nodeId, Attributes.DisplayName).getValue().toString();
Output: (en) TestDevice1
Any idea how can I get the absolute tag Name i.e . TestDevice1 without anything else appended to it. Please advice.
12:52, EEST
April 3, 2012
OfflineHi,
What you are seeing is the “absolute tag name”, i.e. it is supposed to have the number part. Please read OPC UA Specification Part 3 for the different Attributes. Each of them maps to a class which you can cast the value to. Note that in OPC UA there is no concept of Tag the same way in old OPC had. In UA the NodeId Attribute is the unique identifier for a node.
BrowseName Attribute is a QualifiedName, which has a namespace index part and name part. It has .getName(), which can be used to get the name part. i.e.
DisplayName Attribute is a LocalizedText, which contains a locale part and the text part. It has .getText(), which can be used to get the text part.
Note that you can also call client.getAddressSpace().getNode(nodeId) and get the attributes from the UaNode.
– Bjarne

Log In
Register