Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Browsing Nodes results in zero items

More
02 Apr 2020 12:52 #8347 by support
Hello.
You are right about the BrowseNodes in Examples, I have somehow confused it, it browses both the branches and the leaves.

I do not know why running under debugger should make any difference. I have reviewed your code and do not see any obvious problem. It is a mystery.

One possibility would be to deploy the so-called OPC Analyzer, and capture the communication between the client and the server and then determine who is "to blame" or what is where it gets wrong. The downside is that it is an extra work (are you willing to do that?) and that sometimes, because the OPC Analyzer acts as both OPC Client and Server and sits in the middle, its usage actually changes the behavior - making it useless.

Regards
The following user(s) said Thank You: ToSi

Please Log in or Create an account to join the conversation.

More
02 Apr 2020 07:00 #8345 by ToSi
Thank you for the fast reply.
The Example should also work, because it is calling BrowseNodes, at least the version I claim does so. But I think I already figured it out. The Problem is that if I am starting the program via debugger, it won’t give me any results for the CodeSys Server but if I start the .exe it will work just fine.
Even though I managed to solve this kind of Problem somehow (by starting the .exe not the debugger) I can show you my code for browsing the servers. Maybe you can explain to me why the call via debugger has impact on the result.

- The Serverdescriptor is generated by the ServerElement from BrowseServers
Public Shared Function LoadViaNetwork() As clsOPCStructureXML
            Dim oDAClient As New EasyDAClient
            Dim oServerList As ServerElementCollection = oDAClient.BrowseServers("", OpcTechnologies.All)
            Dim oServerTree As New List(Of clsOPCServer)
 
            AddHandler oDAClient.EventingFailure, _
                Sub(sender As Object, e As OpcLabs.BaseLib.FailureEventArgs)
                    Logger.WriteException(e.Exception)
                End Sub
 
            For Each oServer As ServerElement In oServerList
                Dim oOPCServer As New clsOPCServer(oServer)
 
                LoadNodesForServer(oOPCServer, oDAClient)
                oServerTree.Add(oOPCServer)
            Next
 
            oDAClient.Dispose()
 
            Return New clsOPCStructureXML(oServerTree)
        End Function
 
 
        Public Shared Sub LoadNodesForServer(ByVal poOPCServer As clsOPCServer, ByVal poDAClient As EasyDAClient)
            Dim oServerDescriptor As New ServerDescriptor(poOPCServer.Server)
 
            poOPCServer.Nodes.Clear()
            poOPCServer.Nodes.AddRange(LoadNodesForBranch(poDAClient, oServerDescriptor, DANodeDescriptor.Root))
        End Sub
 
        Public Shared Function LoadNodesForBranch(ByVal poDAClient As EasyDAClient, ByVal poServerDescriptor As ServerDescriptor, ByVal poParentNode As DANodeDescriptor) As List(Of clsOPCNode)
            Dim oOPCNodeList As New List(Of clsOPCNode)
 
            Try
                Dim oBrowseParams = New DABrowseParameters
                Dim oNodeCollection As DANodeElementCollection = poDAClient.BrowseNodes(poServerDescriptor, poParentNode, oBrowseParams)
 
                For Each nodeElement As DANodeElement In oNodeCollection
                    If nodeElement.IsBranch Then
                        Dim oOPCBranch As New clsOPCBranch(nodeElement)
 
                        oOPCBranch.Nodes.AddRange(LoadNodesForBranch(poDAClient, poServerDescriptor, nodeElement))
                        oOPCNodeList.Add(oOPCBranch)
                    Else
                        oOPCNodeList.Add(nodeElement)
                    End If
                Next nodeElement
            Catch ex As OpcException
                Logger.WriteException(ex)
            Catch ex As Exception
                Logger.WriteException(ex)
            End Try
 
            Return oOPCNodeList
        End Function

For better understanding I am showing you the different results (same Program).

Result of the debugger


Result of runing the .exe (log)


The last part of question (PLC-Name) was just a mistake of mine and has nothing to do with QuickOPC.

Best regards
Attachments:

Please Log in or Create an account to join the conversation.

More
01 Apr 2020 16:06 #8341 by support
Hello.

As you can see from the browsing dialog (which you claim works OK), the server has no branches under the root, only leaves (items).
This is why the example from DocExamples returns 0 nodes: because you have chosen the example that browses branches, not leaves.

As to your own example, I will need to see the code that calls the LoadNodesForBranch function. I need to know the initial value of especially the "poParentNode", that's quite relevant.

It should be noted that the browsing dialog also uses the very same BrowseNodes method of QuickOPC, so if there is a difference in outputs, there must be a difference in inputs.

I do not understand the following part at all - if it is important, please explain/elaborate: "I also want to mention that I managed to configure the server so that I can browse all my nodes, but the PLC-Name was missing, which will lead to the point that subscribing to items won’t work because the client can’t find these.".

Best regards

Please Log in or Create an account to join the conversation.

More
01 Apr 2020 10:00 #8337 by ToSi
Dear OPC Labs Team,

I am currently developing a service where one part is to browse the whole structure of an OPC-Server. Right now, I am using a CodeSys Testserver. Your Demo Application (OPC-DA) can browse all nodes of this server. The Problem is that if I try to browse all nodes with the EasyDAClient class, the result will always be 0 nodes. I already tried your VB Examples and there will also be 0 nodes for this server. So, in conclusion your example of browsing nodes (which is like my approach) won't find any nodes, but your Demo Application can do so. I also want to mention that I managed to configure the server so that I can browse all my nodes, but the PLC-Name was missing, which will lead to the point that subscribing to items won’t work because the client can’t find these.

My Code (using defualt settings):

- works fine with OPCLabsKitServer but returns 0 nodes on CodeSys Server
Public Shared Function LoadNodesForBranch(ByVal poDAClient As EasyDAClient, ByVal poServerDescriptor As ServerDescriptor, ByVal poParentNode As DANodeDescriptor) As List(Of clsOPCNode)
            Dim oOPCNodeList As New List(Of clsOPCNode)
 
            Try
                Dim oBrowseParams = New DABrowseParameters
                Dim oNodeCollection As DANodeElementCollection = poDAClient.BrowseNodes(poServerDescriptor, poParentNode, oBrowseParams)
 
                For Each nodeElement As DANodeElement In oNodeCollection
                    If nodeElement.IsBranch Then
                        Dim oOPCBranch As New clsOPCBranch(nodeElement)
 
                        oOPCBranch.Nodes.AddRange(LoadNodesForBranch(poDAClient, poServerDescriptor, nodeElement))
                        oOPCNodeList.Add(oOPCBranch)
                    Else
                        oOPCNodeList.Add(nodeElement)
                    End If
                Next nodeElement
            Catch ex As OpcException
                Logger.WriteException(ex)
            Catch ex As Exception
                Logger.WriteException(ex)
            End Try
 
            Return oOPCNodeList
        End Function




This is correct and wanted as the result of BrowseNodes()


I changed the Server to the CodeSys Server in the Example...
Attachments:

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.060 seconds