仅在顶层上浏览OPCUA节点

问题描述 投票:0回答:1

我正在使用OPC UA项目https://github.com/OPCFoundation/UA-Java。我能够使用UAExpert浏览OPCUA服务器上的所有节点。

现在,我尝试使用Java客户端浏览所有节点。我能够在节点层次结构的第一层中检索节点的引用,其中rootnameSpace = 1和rootIdentifier =“ simsre”

BrowseDescription browse = new BrowseDescription();
browse.setNodeId(new NodeId(rootnameSpace, rootIdentifier));
browse.setBrowseDirection(BrowseDirection.Forward);
browse.setIncludeSubtypes(true);
browse.setNodeClassMask(NodeClass.Object, NodeClass.Variable);
browse.setResultMask(BrowseResultMask.All );
BrowseResponse res = mySession.Browse(null, null, null, browse);
ReferenceDescription[] references = res.getResults()[0].getReferences(); 

[当我在下面调用其他节点的代码,例如rootnameSpace = 31和rootIdentifier =“ / simsrede /”时,我仍然得到结果,但没有引用(因此res.getResults()[0] .getReferences()返回null)-BrowseResponse的状态代码类似于“ GOOD”-

根据规范,标识符中允许所有unicode字符,因此斜杠和'|'不应该是问题。

我还尝试将条目添加到我的命名空间表中,并使用该表在以[]为根节点开始的连续浏览请求中设置节点ID。

NamespaceTable table = NamespaceTable.getDefaultInstance();  
table.add(1, "urn:something:UnifiedAutomation:Uagateway"); 

...
//consecutive browse request starting from reference returned by first call
browse1.setNodeId(table.toNodeId(references[0].getNodeId()));
BrowseResponse res1 = mySession.Browse(null, null, null, browse);
ReferenceDescription[] references1 = res.getResults()[0].getReferences(); 

任何人都知道为什么它会返回空引用,或者如何调试它?

我正在使用OPC UA项目https://github.com/OPCFoundation/UA-Java。我能够使用UAExpert浏览OPCUA服务器上的所有节点。现在,我尝试使用Java客户端浏览所有节点。我...

java client opc-ua
1个回答
0
投票

感谢@Kevin Herron的提示。我最终可以在使用milo实施客户端时解决此问题。我必须在浏览调用之前设置browse.setReferenceTypeId(Identifiers.HierarchicalReferences,因为所有引用都是分层的。我实际上以为默认值是返回所有类型的引用。

© www.soinside.com 2019 - 2024. All rights reserved.