Я надеюсь, что кто-то может мне помочь.
Я пишу клиент OPC-UA в Java и могу просматривать только первый узел.
ResponseHeader=ResponseHeader
Timestamp=05/11/18 09:38:42.3063457 GMT
RequestHandle=0
ServiceResult=GOOD (0x00000000) ""
ServiceDiagnostics=Diagnostic Info:
StringTable=class java.lang.String[0]
AdditionalHeader=null
Results=class org.opcfoundation.ua.core.BrowseResult[1]
[0]=BrowseResult
StatusCode=GOOD (0x00000000) ""
ContinuationPoint=null
References=class org.opcfoundation.ua.core.ReferenceDescription[2]
[0]=ReferenceDescription
ReferenceTypeId=i=35
IsForward=true
NodeId=nsu=http%3A%2F%2Fopcfoundation.org%2FUA%2F;i=2253
BrowseName=Server
DisplayName=Server
NodeClass=NodeClass
value=1
name=Object
ordinal=1
TypeDefinition=nsu=http%3A%2F%2Fopcfoundation.org%2FUA%2F;i=2004
[1]=ReferenceDescription
ReferenceTypeId=i=35
IsForward=true
NodeId=ns=2;s=WRT
BrowseName=2:WRT
DisplayName=WRT
NodeClass=NodeClass
value=1
name=Object
ordinal=1
TypeDefinition=nsu=http%3A%2F%2Fopcfoundation.org%2FUA%2F;i=58
DiagnosticInfos=class org.opcfoundation.ua.builtintypes.DiagnosticInfo[0]
Я бы увидел другие ветви дерева. Но второй просмотр возвращает ноль.
2018-05-11 11:22:56,190 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - i = 0 x= 0
2018-05-11 11:22:56,191 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - BrowseName Server
2018-05-11 11:22:56,191 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - NodeId nsu=http%3A%2F%2Fopcfoundation.org%2FUA%2F;i=2253
2018-05-11 11:22:56,191 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - DisplayName Server
2018-05-11 11:22:56,192 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - BrowseResponse
ResponseHeader=ResponseHeader
Timestamp=05/11/18 09:22:56.1916234 GMT
RequestHandle=0
ServiceResult=GOOD (0x00000000) ""
ServiceDiagnostics=Diagnostic Info:
StringTable=class java.lang.String[0]
AdditionalHeader=null
Results=class org.opcfoundation.ua.core.BrowseResult[1]
[0]=BrowseResult
StatusCode=GOOD (0x00000000) ""
ContinuationPoint=null
References=class org.opcfoundation.ua.core.ReferenceDescription[0]
DiagnosticInfos=class org.opcfoundation.ua.builtintypes.DiagnosticInfo[0]
2018-05-11 11:22:56,192 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - i = 0 x= 1
2018-05-11 11:22:56,192 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - BrowseName 2:WRT
2018-05-11 11:22:56,192 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - NodeId ns=2;s=WRT
2018-05-11 11:22:56,192 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - DisplayName WRT
2018-05-11 11:22:56,193 [Component Resolve Thread (Bundle 6)] DEBUG c.a.o.u.ClientService - BrowseResponse
ResponseHeader=ResponseHeader
Timestamp=05/11/18 09:22:56.1931274 GMT
RequestHandle=0
ServiceResult=GOOD (0x00000000) ""
ServiceDiagnostics=Diagnostic Info:
StringTable=class java.lang.String[0]
AdditionalHeader=null
Results=class org.opcfoundation.ua.core.BrowseResult[1]
[0]=BrowseResult
StatusCode=GOOD (0x00000000) ""
ContinuationPoint=null
References=class org.opcfoundation.ua.core.ReferenceDescription[0]
DiagnosticInfos=class org.opcfoundation.ua.builtintypes.DiagnosticInfo[0]
здесь мой код для просмотра на 2 уровнях:
public void browse(NodeId nodeId) throws ServiceFaultException, ServiceResultException {
BrowseDescription browse = new BrowseDescription();
browse.setNodeId(nodeId);
browse.setBrowseDirection(BrowseDirection.Forward);
browse.setIncludeSubtypes(true);
browse.setNodeClassMask(NodeClass.Object, NodeClass.Variable, NodeClass.View);
browse.setResultMask(BrowseResultMask.All);
BrowseResponse browseResponse = null;
int k = 1;
try {
browseResponse = mySession.Browse(null, null, null, browse);
logger.debug(browseResponse.toString());
} catch (ServiceResultException e) {
logger.error("Exception", e);
}
BrowseResult[] browseResult = browseResponse.getResults();
for (int i = 0; i < browseResult.length; i++) {
ReferenceDescription[] referenceDescription = browseResult[i].getReferences();
for (int x = 0; x < referenceDescription.length; x++) {
logger.debug("i = " + i + " x= " + x);
logger.debug("BrowseName " + referenceDescription[x].getBrowseName());
logger.debug("NodeId " + referenceDescription[x].getNodeId());
logger.debug("DisplayName " + referenceDescription[x].getDisplayName());
BrowseDescription browse1 = new BrowseDescription();
browse1.setNodeId(referenceDescription[x].getReferenceTypeId().ID);
browse1.setBrowseDirection(BrowseDirection.Forward);
browse1.setIncludeSubtypes(true);
browse1.setReferenceTypeId(referenceDescription[x].getReferenceTypeId().ID);
browse1.setNodeClassMask(NodeClass.Object, NodeClass.Variable, NodeClass.View, NodeClass.Method, NodeClass.ObjectType, NodeClass.VariableType, NodeClass.ReferenceType, NodeClass.DataType);
browse1.setResultMask(BrowseResultMask.All);
BrowseResponse browseResponse1 = null;
try {
browseResponse1 = mySession.Browse(null, null, null, browse1);
if (browseResponse1 != null) {
logger.debug(browseResponse1.toString());
}
} catch (ServiceResultException e) {
logger.error("Exception", e);
}
}
}
}
Другой клиент показал другие папки после WRT forlder.