Hello.
There is a server in public access, here are its parameters:
EndpointUrl: opc.tcp://opc.owencloud.ru:4843
UserName: This email address is being protected from spambots. You need JavaScript enabled to view it.
Password: demo123
Security: None, None
This server has a problem with tags. Some attributes cannot be read (see the example in the attachment). But some attributes are readable.
Unfortunately, my program users want to work with this server and read those attributes that can be read. But an error occurs every time I try to read tags through the "ReadValue" function. Therefore, I decided to read only one attribute: "UAAttributeId_DataType" from the tag "NamespaceArray". With the help of UAExpert, I see that this attribute (DataType) is available and can be read. I took the code from the example "..\OPC Labs QuickOPC 2019.2\Examples-COM\OP\UADocExamples\_EasyUAClient\ReadMultipleValues.DataType.inc". Changed it like this:
class procedure ReadMultipleValues.DataType;
var
Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
ReadArguments1, ReadArguments2, ReadArguments3: _UAReadArguments;
Arguments, Results: OleVariant;
I: Cardinal;
Result: _ValueResult;
aSession: _UASmartSessionParameters;
begin
Client := CoEasyUAClient.Create;
Client.Isolated := TRUE;
aSession := Client.IsolatedParameters.SessionParameters;
aSession.UserIdentity.UserNameTokenInfo.UserName := 'demo@owen.ru';
aSession.UserIdentity.UserNameTokenInfo.Password := 'demo123';
ReadArguments1 := CoUAReadArguments.Create;
ReadArguments1.EndpointDescriptor.UrlString := 'opc.tcp://opc.owencloud.ru:4843';
ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'ns=0;i=2255'; // NamespaceArray
ReadArguments1.AttributeId := UAAttributeId_DataType; // DataType attribute
Arguments := VarArrayCreate([0, 0], varVariant);
Arguments[0] := ReadArguments1;
TVarData(Results).VType := varArray or varVariant;
TVarData(Results).VArray := PVarArray(Client.ReadMultipleValues(Arguments));
for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
begin
Result := IInterface(Results[I]) as _ValueResult;
WriteLn;
if Result.Succeeded then
begin
WriteLn('Value: ', Result.Value);
WriteLn('Value.ExpandedText: ', Result.Value.ExpandedText);
WriteLn('Value.NamespaceUriString: ', Result.Value.NamespaceUriString);
WriteLn('Value.NamespaceIndex: ', Result.Value.NamespaceIndex);
WriteLn('Value.NumericIdentifier: ', Result.Value.NumericIdentifier);
end
else
WriteLn('results(', I, ') *** Failure: ', Result.ErrorMessageBrief);
end;
end;
But again I get the error: "results(0) *** Failure: OPC-UA service result - (no description available) = BadNodeIdUnknown". The same thing when trying to read other attributes.
Is there any way to read those attributes that are readable? Maybe I'm doing something wrong?