OPC Studio User's Guide and Reference
BrowseMethods Method (_EasyUAClient)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.ComTypes Namespace > _EasyUAClient Interface : BrowseMethods Method
Endpoint descriptor. Identifies the OPC-UA server.
Node descriptor. Identifies the node in OPC server's address space.
Browses the Methods, specifying an endpoint descriptor, and a starting Node Id.
Syntax
'Declaration
 
<ElementsNotNullAttribute()>
<NotNullAttribute()>
Function BrowseMethods( _
   ByVal endpointDescriptorString As String, _
   ByVal nodeDescriptorString As String _
) As UANodeElementCollection
'Usage
 
Dim instance As _EasyUAClient
Dim endpointDescriptorString As String
Dim nodeDescriptorString As String
Dim value As UANodeElementCollection
 
value = instance.BrowseMethods(endpointDescriptorString, nodeDescriptorString)
[ElementsNotNull()]
[NotNull()]
UANodeElementCollection BrowseMethods( 
   string endpointDescriptorString,
   string nodeDescriptorString
)
[ElementsNotNull()]
[NotNull()]
UANodeElementCollection^ BrowseMethods( 
   String^ endpointDescriptorString,
   String^ nodeDescriptorString
) 

Parameters

endpointDescriptorString
Endpoint descriptor. Identifies the OPC-UA server.
nodeDescriptorString
Node descriptor. Identifies the node in OPC server's address space.

Return Value

The method returns a node element collection, which contains OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement values. Each element contains information about a particular node found.
Example

COM

// This example shows how to obtain all method nodes under a given node of the OPC-UA address space.
// For each node, it displays its browse name and node ID.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#include "stdafx.h"    // Includes "QuickOpc.h", and other commonly used files
#include "BrowseMethods.h"

namespace _EasyUAClient
{
    void BrowseMethods::Main()
    {
        // Initialize the COM library
        CoInitializeEx(NULL, COINIT_MULTITHREADED);
        {
            // Instantiate the client object
            _EasyUAClientPtr ClientPtr(__uuidof(EasyUAClient));

            // Perform the operation
            _UANodeElementCollectionPtr NodeElementsPtr = ClientPtr->BrowseMethods(
                //L"http://opcua.demo-this.com:51211/UA/SampleServer", 
                L"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer",
                L"nsu=http://test.org/UA/Data/ ;i=10755");
    
            // Display results
            IEnumVARIANTPtr EnumNodeElementPtr = NodeElementsPtr->GetEnumerator();
            _variant_t vNodeElement;
            while (EnumNodeElementPtr->Next(1, &vNodeElement, NULL) == S_OK)
            {
                _UANodeElementPtr NodeElementPtr(vNodeElement);
                _tprintf(_T("%s: "), (LPCTSTR)CW2CT(NodeElementPtr->BrowseName->ToString));
                _tprintf(_T("%s\n"), (LPCTSTR)CW2CT(NodeElementPtr->NodeId->ToString));
                vNodeElement.Clear();
            }
        }
         // Release all interface pointers BEFORE calling CoUninitialize()
        CoUninitialize();
    }
}
// This example shows how to obtain all method nodes under a given node of
// the OPC-UA address space. For each node, it displays its browse name and
// node ID.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure BrowseMethods.Main;
var
  Client: EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  NodeElements := Client.BrowseMethods(
    //'http://opcua.demo-this.com:51211/UA/SampleServer',
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
    'nsu=http://test.org/UA/Data/ ;i=10755');

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;
end;
// This example shows how to obtain all method nodes under a given node of
// the OPC-UA address space. For each node, it displays its browse name and
// node ID.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure BrowseMethods.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
begin
  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  try
    NodeElements := Client.BrowseMethods(
      //'http://opcua.demo-this.com:51211/UA/SampleServer',
      //'https://opcua.demo-this.com:51212/UA/SampleServer/',
      'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer',
      'nsu=http://test.org/UA/Data/ ;i=10755');
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn(NodeElement.BrowseName.ToString, ': ', NodeElement.NodeId.ToString);
  end;

  // Example output:
  // ScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10756
  // ScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10759
  // ScalarMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10762
  // ArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10765
  // ArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10768
  // ArrayMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10771
  // UserScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10774
  // UserScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10777
  // UserArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10780
  // UserArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10783

end;
// This example shows how to obtain all method nodes under a given node of the OPC-UA address space. 
// For each node, it displays its browse name and node ID.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

// Instantiate the client object
$Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient");

// Perform the operation
try
{
    $NodeElements = $Client->BrowseMethods(
        //"http://opcua.demo-this.com:51211/UA/SampleServer", 
        "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", 
        "nsu=http://test.org/UA/Data/ ;i=10755");
}
catch (com_exception $e)
{
    printf("*** Failure: %s\n", $e->getMessage());
    Exit();
}


// Display results
foreach ($NodeElements as $NodeElement)
{
    printf(" s\n", $NodeElement->BrowseName, $NodeElement->NodeId);
}
REM This example shows how to obtain all method nodes under a given node of the OPC-UA address space.
REM For each node, it displays its browse name and node ID.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Public Sub BrowseMethods_Main_Command_Click()
    OutputText = ""

    ' Instantiate the client object
    Dim Client As New EasyUAClient

    ' Perform the operation
    On Error Resume Next
    Dim NodeElements As UANodeElementCollection
    Set NodeElements = Client.BrowseMethods("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755")
    If Err.Number <> 0 Then
        OutputText = OutputText & "*** Failure: " & Err.Source & ": " & Err.Description & vbCrLf
        Exit Sub
    End If
    On Error GoTo 0

    ' Display results
    Dim NodeElement: For Each NodeElement In NodeElements
        OutputText = OutputText & NodeElement.BrowseName & ": " & NodeElement.NodeId & vbCrLf
    Next
End Sub
Rem This example shows how to obtain all method nodes under a given node of the OPC-UA address space. 
Rem For each node, it displays its browse name and node ID.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Option Explicit

' Instantiate the client object
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")

' Perform the operation
On Error Resume Next
Dim NodeElements: Set NodeElements = Client.BrowseMethods("opc.tcp://opcua.demo-this.com:51210/UA/SampleServer", "nsu=http://test.org/UA/Data/ ;i=10755")
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

' Display results
Dim NodeElement: For Each NodeElement In NodeElements
    WScript.Echo NodeElement.BrowseName & ": " & NodeElement.NodeId
Next


' Example output:
'ScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10756
'ScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10759
'ScalarMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10762
'ArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10765
'ArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10768
'ArrayMethod3: nsu=http://test.org/UA/Data/ ;ns=2;i=10771
'UserScalarMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10774
'UserScalarMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10777
'UserArrayMethod1: nsu=http://test.org/UA/Data/ ;ns=2;i=10780
'UserArrayMethod2: nsu=http://test.org/UA/Data/ ;ns=2;i=10783
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also