Avatar

Please consider registering
guest

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
browsing server nodes with List references = client.getAddressSpace().browse(nodeId);
April 25, 2013
12:52, EEST
Avatar
Eric V
New Member
Members
Forum Posts: 2
Member Since:
April 25, 2013
sp_UserOfflineSmall Offline

Hey,

when I browse server nodes with

NodeId nodeId = Identifiers.RootFolder;
List references = client.getAddressSpace().browse(nodeId);

in my client application I don’t understand in which order I get the Nodes that are contained in the root folder. Right now the root folder contains three folders:

Objects (NodeId Identifier “85”)
Types (NodeId Identifier “86”)
Views (NodeId Identifier “87”)

These three are also shown, when I browse the root folder with UA Expert.

Printing out “references” on the console gives me:[ReferenceDescription: ReferenceDescription (id=20978984)
TypeDefinition=ExpandedNodeId (id=3829340)
namespaceUri=null
value=UnsignedInteger (id=2326550)
value=61
serverIndex=UnsignedInteger (id=18769836)
value=0
type=IdType (id=7488714)
ordinal=0
name=Numeric
namespaceIndex=0
BrowseName=QualifiedName (id=11421254)
name=Views SmileSmile
namespaceIndex=0
NodeClass=NodeClass (id=3093871)
value=1
ordinal=1
name=Object
DisplayName=LocalizedText (id=31056583)
hash=372447508
locale=en-US
text=Views
ReferenceTypeId=NodeId (id=28814882)
value=UnsignedInteger (id=610720)
value=35
type=IdType (id=7488714)
namespaceIndex=0
NodeId=ExpandedNodeId (id=30284778)
namespaceUri=null
value=UnsignedInteger (id=9097155)
value=87
serverIndex=UnsignedInteger (id=18769836)
type=IdType (id=7488714)
namespaceIndex=0
IsForward=true
, ReferenceDescription: ReferenceDescription (id=21892752)
TypeDefinition=ExpandedNodeId (id=27136417)
namespaceUri=null
value=UnsignedInteger (id=9936743)
value=61
serverIndex=UnsignedInteger (id=18769836)
value=0
type=IdType (id=7488714)
ordinal=0
name=Numeric
namespaceIndex=0
BrowseName=QualifiedName (id=6447371)
name=Objects
namespaceIndex=0
NodeClass=NodeClass (id=3093871)
value=1
ordinal=1
name=Object SmileSmile
DisplayName=LocalizedText (id=13709034)
hash=294800314
locale=en-US
text=Objects
ReferenceTypeId=NodeId (id=23008635)
value=UnsignedInteger (id=610720)
value=35
type=IdType (id=7488714)
namespaceIndex=0
NodeId=ExpandedNodeId (id=24854782)
namespaceUri=null
value=UnsignedInteger (id=15202027)
value=85
serverIndex=UnsignedInteger (id=18769836)
type=IdType (id=7488714)
namespaceIndex=0
IsForward=true
, ReferenceDescription: ReferenceDescription (id=17030800)
TypeDefinition=ExpandedNodeId (id=17365216)
namespaceUri=null
value=UnsignedInteger (id=749304)
value=61
serverIndex=UnsignedInteger (id=18769836)
value=0
type=IdType (id=7488714)
ordinal=0
name=Numeric
namespaceIndex=0
BrowseName=QualifiedName (id=10656878)
name=Types SmileSmile
namespaceIndex=0
NodeClass=NodeClass (id=3093871)
value=1
ordinal=1
name=Object
DisplayName=LocalizedText (id=30149247)
hash=371087135
locale=en-US
text=Types
ReferenceTypeId=NodeId (id=12919296)
value=UnsignedInteger (id=610720)
value=35
type=IdType (id=7488714)
namespaceIndex=0
NodeId=ExpandedNodeId (id=3885854)
namespaceUri=null
value=UnsignedInteger (id=12626425)
value=86
serverIndex=UnsignedInteger (id=18769836)
type=IdType (id=7488714)
namespaceIndex=0
IsForward=true
, ReferenceDescription: ReferenceDescription (id=14098944)
TypeDefinition=ExpandedNodeId (id=33108879)
namespaceUri=null
value=UnsignedInteger (id=27790058)
value=61
serverIndex=UnsignedInteger (id=18769836)
value=0
type=IdType (id=7488714)
ordinal=0
name=Numeric
namespaceIndex=0
BrowseName=QualifiedName (id=23378358)
name=Objects
namespaceIndex=0
NodeClass=NodeClass (id=3093871)
value=1
ordinal=1
name=Object
DisplayName=LocalizedText (id=31220901)
hash=294800314
locale=en-US
text=Objects SmileSmile
ReferenceTypeId=NodeId (id=5489653)
value=UnsignedInteger (id=610720)
value=35
type=IdType (id=7488714)
namespaceIndex=0
NodeId=ExpandedNodeId (id=23475212)
namespaceUri=null
value=UnsignedInteger (id=14892568)
value=85
serverIndex=UnsignedInteger (id=18769836)
type=IdType (id=7488714)
namespaceIndex=0
IsForward=true
, ReferenceDescription: ReferenceDescription (id=16886931)
TypeDefinition=ExpandedNodeId (id=15272259)
namespaceUri=null
value=UnsignedInteger (id=23011228)
value=61
serverIndex=UnsignedInteger (id=18769836)
value=0
type=IdType (id=7488714)
ordinal=0
name=Numeric
namespaceIndex=0
BrowseName=QualifiedName (id=1340650)
name=Types
namespaceIndex=0
NodeClass=NodeClass (id=3093871)
value=1
ordinal=1
name=Object
DisplayName=LocalizedText (id=17284365)
hash=371087135
locale=en-US
text=Types SmileSmile
ReferenceTypeId=NodeId (id=17605128)
value=UnsignedInteger (id=610720)
value=35
type=IdType (id=7488714)
namespaceIndex=0
NodeId=ExpandedNodeId (id=6419763)
namespaceUri=null
value=UnsignedInteger (id=19473142)
value=86
serverIndex=UnsignedInteger (id=18769836)
type=IdType (id=7488714)
namespaceIndex=0
IsForward=true
, ReferenceDescription: ReferenceDescription (id=28732166)
TypeDefinition=ExpandedNodeId (id=19699031)
namespaceUri=null
value=UnsignedInteger (id=40717)
value=61
serverIndex=UnsignedInteger (id=18769836)
value=0
type=IdType (id=7488714)
ordinal=0
name=Numeric
namespaceIndex=0
BrowseName=QualifiedName (id=13252483)
name=Views
namespaceIndex=0
NodeClass=NodeClass (id=3093871)
value=1
ordinal=1
name=Object
DisplayName=LocalizedText (id=173823)
hash=372447508
locale=en-US
text=Views SmileSmile
ReferenceTypeId=NodeId (id=2216507)
value=UnsignedInteger (id=610720)
value=35
type=IdType (id=7488714)
namespaceIndex=0
NodeId=ExpandedNodeId (id=7414959)
namespaceUri=null
value=UnsignedInteger (id=2062088)
value=87
serverIndex=UnsignedInteger (id=18769836)
type=IdType (id=7488714)
namespaceIndex=0
IsForward=true
]

Can someone explain the order since here the first object of references is Views, then Objects, then Types. And I’m getting another three Objects, Types, Views…
What is the order of the first three? I guess the last three are the nodes in alphabetical order according to the display text. Does client.getAddressSpace().browse(nodeId); always return the nodes twice and in two different orders?

Edit:
The fact, that the nodes appear twice seems to be because the node has two references “HasTypeDefinition”. I couldn’t figure out the order though.

Or is there any way to get an object of type NodeId if you only know the nodes’ path? I found this post but UaClient.getAddressSpace().translateBrowsePathToNodeId() returns BrowsePathresult[] and furthermore: how do you pass the browsepath to the method translateBrowsePathToNodeId.

Thanks a lot.
Eric

April 25, 2013
17:55, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

You did not mention which server you are connecting to: it seems that it is indeed returning the nodes twice. TypeDefinition is not included in the default browse, since it is not a hierarchical reference (you can define the desired types with AddressSpace.setReferenceTypeId() and setIncludeSubTypes().

The order of the references is not defined so the server is free to provide them in any order. Client apps, such as UaExpert and Prosys Java Client, typically sort them alphabetically.

About translateBrowsePathToNodeId. This is in the SampleConsoleClient:

String s = readInput(false);
final QualifiedName targetName = new QualifiedName(
nodeId.getNamespaceIndex(), s);
BrowsePathTarget pathTarget = client.getAddressSpace()
.translateBrowsePathToNodeId(
nodeId,
new RelativePathElement(
Identifiers.HierarchicalReferences,
false, true, targetName))[0];
println("Target: " + pathTarget.getTargetId());
println("RemainingPathIndex: "
+ pathTarget.getRemainingPathIndex());

You need to define one RelativePathElement for each reference “hop”. Also if you wish to look up several NodeIds at once, it is better to use translateBrowsePathsToNodeIds().

The example is just looking up a single NodeId directly under the current node (nodeId).

April 26, 2013
12:32, EEST
Avatar
Eric V
New Member
Members
Forum Posts: 2
Member Since:
April 25, 2013
sp_UserOfflineSmall Offline

Thanks a lot for your answer. It helped me out a lot.
In this case it’s an just an internal testserver, running on a machine control. There might be something configured wrong and that’s why I get the nodes returned twice. I’ll try to work with the browse path though!

Why is it though, if the Prosys Java Client sorts the nodes in alphabetical order, that the first three nodes are listed as: 1. Views 2. Object 3. Types. Only the second set is ordered alphabetically.
Thanks!

April 26, 2013
15:31, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

I was referring to our GUI client application: not the default behavior of the Client SDK. So what you see here is how the browse response message comes from the server.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
34 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: 734

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1523

Posts: 6449

Newest Members:

christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1