// This example shows how to obtain properties under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
class procedure BrowseProperties.Main;
var
Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
Count: Cardinal;
Element: OleVariant;
EndpointDescriptor: string;
NodeElement: _UANodeElement;
NodeElementEnumerator: IEnumVariant;
NodeElements: _UANodeElementCollection;
ServerNodeId: _UANodeId;
begin
EndpointDescriptor :=
//'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';
// Instantiate the client object
Client := CoEasyUAClient.Create;
// Obtain properties under "Server" node
ServerNodeId := CoUANodeId.Create;
ServerNodeId.StandardName := 'Server';
try
NodeElements := Client.BrowseProperties(EndpointDescriptor, ServerNodeId.ExpandedText);
except
on E: EOleException do
begin
WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
Exit;
end;
end;
// Display results
NodeElementEnumerator := NodeElements.GetEnumerator;
while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
begin
NodeElement := IUnknown(Element) as _UANodeElement;
WriteLn;
WriteLn('nodeElement.NodeId: ', NodeElement.NodeId.ToString);
WriteLn('nodeElement.NodeId.ExpandedText: ', NodeElement.NodeId.ExpandedText);
WriteLn('nodeElement.DisplayName: ', NodeElement.DisplayName);
end;
// Example output:
//
//nodeElement.NodeId: Server_ServerArray
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
//nodeElement.DisplayName: ServerArray
//
//nodeElement.NodeId: Server_NamespaceArray
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
//nodeElement.DisplayName: NamespaceArray
//
//nodeElement.NodeId: Server_ServiceLevel
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
//nodeElement.DisplayName: ServiceLevel
//
//nodeElement.NodeId: Server_Auditing
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
//nodeElement.DisplayName: Auditing
end;
// This example shows how to obtain properties under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
$EndpointDescriptor = new COM("OpcLabs.EasyOpc.UA.UAEndpointDescriptor");
$EndpointDescriptor->UrlString =
//"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";
// Instantiate the client object
$Client = new COM("OpcLabs.EasyOpc.UA.EasyUAClient");
// Obtain variables under "Server" node
$ServerNodeId = new COM("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId");
$ServerNodeId->StandardName = "Server";
try
{
$NodeElements = $Client->BrowseProperties($EndpointDescriptor, $ServerNodeId->ExpandedText);
}
catch (com_exception $e)
{
printf("*** Failure: %s\n", $e->getMessage());
exit();
}
// Display results
foreach ($NodeElements as $NodeElement)
{
printf("\n");
printf("nodeElement.NodeId: %s\n", $NodeElement->NodeId);
printf("nodeElement.NodeId.ExpandedText: %s\n", $NodeElement->NodeId->ExpandedText);
printf("nodeElement.DisplayName: %s\n", $NodeElement->DisplayName);
}
// Example output:
//
//nodeElement.NodeId: Server_ServerArray
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
//nodeElement.DisplayName: ServerArray
//
//nodeElement.NodeId: Server_NamespaceArray
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
//nodeElement.DisplayName: NamespaceArray
//
//nodeElement.NodeId: Server_ServiceLevel
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
//nodeElement.DisplayName: ServiceLevel
//
//nodeElement.NodeId: Server_Auditing
//nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
//nodeElement.DisplayName: Auditing
REM This example shows how to obtain properties under the "Server" node
REM in the address space.
REM
REM Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Public Sub BrowseProperties_Main_Command_Click()
OutputText = ""
Dim endpointDescriptor As String
'endpointDescriptor = "http://opcua.demo-this.com:51211/UA/SampleServer"
'endpointDescriptor = "https://opcua.demo-this.com:51212/UA/SampleServer/"
endpointDescriptor = "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
' Instantiate the client object
Dim Client As New EasyUAClient
' Obtain properties under "Server" node
Dim serverNodeId As New UANodeId
serverNodeId.StandardName = "Server"
On Error Resume Next
Dim NodeElements As UANodeElementCollection
Set NodeElements = Client.BrowseProperties(endpointDescriptor, serverNodeId.expandedText)
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 & vbCrLf
OutputText = OutputText & "nodeElement.NodeId: " & NodeElement.NodeId & vbCrLf
OutputText = OutputText & "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.expandedText & vbCrLf
OutputText = OutputText & "nodeElement.DisplayName: " & NodeElement.DisplayName & vbCrLf
Next
' Example output:
'
'nodeElement.NodeId: Server_ServerArray
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
'nodeElement.DisplayName: ServerArray
'
'nodeElement.NodeId: Server_NamespaceArray
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
'nodeElement.DisplayName: NamespaceArray
'
'nodeElement.NodeId: Server_ServiceLevel
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
'nodeElement.DisplayName: ServiceLevel
'
'nodeElement.NodeId: Server_Auditing
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
'nodeElement.DisplayName: Auditing
End Sub
Rem This example shows how to obtain properties under the "Server" node in the address space.
Rem
Rem Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
Option Explicit
Dim endpointDescriptor: endpointDescriptor = _
"opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
'"http://opcua.demo-this.com:51211/UA/SampleServer"
'"https://opcua.demo-this.com:51212/UA/SampleServer/"
' Instantiate the client object
Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient")
' Obtain properties under "Server" node
Dim ServerNodeId: Set ServerNodeId = CreateObject("OpcLabs.EasyOpc.UA.AddressSpace.UANodeId")
ServerNodeId.StandardName = "Server"
On Error Resume Next
Dim NodeElementCollection: Set NodeElementCollection = Client.BrowseProperties(endpointDescriptor, ServerNodeId.ExpandedText)
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 NodeElementCollection
WScript.Echo
WScript.Echo "nodeElement.NodeId: " & NodeElement.NodeId
WScript.Echo "nodeElement.NodeId.ExpandedText: " & NodeElement.NodeId.ExpandedText
WScript.Echo "nodeElement.DisplayName: " & NodeElement.DisplayName
Next
' Example output:
'
'nodeElement.NodeId: Server_ServerArray
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2254
'nodeElement.DisplayName: ServerArray
'
'nodeElement.NodeId: Server_NamespaceArray
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2255
'nodeElement.DisplayName: NamespaceArray
'
'nodeElement.NodeId: Server_ServiceLevel
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2267
'nodeElement.DisplayName: ServiceLevel
'
'nodeElement.NodeId: Server_Auditing
'nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2994
'nodeElement.DisplayName: Auditing