- Posts: 10
- Thank you received: 1
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.
UA Authentication
Of course.
Code to send User and Password, acceptint de certificate:
EasyUAClientConfiguration := TEasyUAClientConfiguration.Create(nil);
UserIdentity := TUserIdentity.Create(nil);
try
UserIdentity.UserNameTokenInfo.UserName := ParamStr2;
Useridentity.UserNameTokenInfo.Password := ParamStr3;
EasyUAClientConfiguration.AdaptableParameters.SessionParameters.UserIdentity := Useridentity.DefaultInterface;
EasyUAClientConfiguration.RemoteMachineName := ParamStr1;
EasyUAClientConfiguration.AdaptableParameters.SessionParameters.EndpointSelectionPolicy.AllowedMessageSecurityModes := UAMessageSecurityModes_All;
EasyUAClientConfiguration.SharedParameters.EngineParameters.CertificateAcceptancePolicy.AcceptAnyCertificate := True;
EasyUAClientConfiguration.Connect;
finally
UserIdentity.Free;
EasyUAClientConfiguration.Free;
end;For each value I need to read:
ReadArgument := CoUAReadArguments.Create;
ReadArgument.EndpointDescriptor.UrlString := strOPCServer;
ReadArgument.NodeDescriptor.NodeId.ExpandedText := NodeId + OPCItem;
ReadArgument.AttributeId := UAAttributeId_DataType;The code to Read the items:
TVarData(Results).VType := varArray or varVariant;
TVarData(Results).VArray := PVarArray(ClienteOPCUA.ReadMultipleValues(PSafeArray(TVarData(Arguments).VArray)));
for intVariable := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
begin
Result := IInterface(Results[intVariable]) as _ValueResult;
if VarIsEmpty(Result.Value) then
SaveError('Value.Value: ' + strIdVariableEscribir + ' - ' + ID_NO_EXISTE)
else
begin
SaveValue(strIdVariableEscribir , Result.Value);
end;
end;Thanks for you help!
Escarre
Please Log in or Create an account to join the conversation.
The proper and secure way to get rid of the certificate validation dialog is to copy the server's certificate to the "trusted peers" certificate store. More information: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...%20Instance%20Certificate.html .
Most likely this means you should inspect the certificates you have under "C:\ProgramData\OPC Foundation\CertificateStores\RejectedCertificates\certs", locate the one you want to trust, and copy it over to "C:\ProgramData\OPC Foundation\CertificateStores\UA Applications\certs". Alternatively, there should also be a (server-specific) way to obtain the server's certificate on the server side directly (without it having to be first transferred to the client and initially rejected).
This will have to be repeated on every machine where the client app will run (and, if it is connecting to different server instances, the server certificates will then of course be different).
There are also insecure ways - not recommended.
Best regards
Please Log in or Create an account to join the conversation.
Finally I can read the data. When the application initiates, this form appears:
Attachment OPCUACertificatescreen.jpg not found
Can I avoid this form?
Thanks a lot,
Escarre
Attachments:
Please Log in or Create an account to join the conversation.
I have attatched the node I want to read.
Thanks,
Escarre
Attachment OPCUATemperature.jpg not found
Attachments:
Please Log in or Create an account to join the conversation.
I made another test, using OnDataChangeNotification.
When I receive the event, the eventArgs.Arguments.NodeDescriptor.DisplayString value NodeId="ns=3;s=_System.General.Temperature"
But eventArgs.AttributeData is nil.
Thanks again,
Escarre
Please Log in or Create an account to join the conversation.
When I want to display results an exception raises: EIntFCastError Interface not supported
But if I use this code (Result is a _ValueResult variable):
Result := IInterface(Results[intVariable]) as _ValueResult
there are no error, but the Result.value is unassigned.
This code in another OPC server works properly, so I don't know why is not working.
Thanks,
Escarre
Please Log in or Create an account to join the conversation.
Reading a list of OPC UA items:
// This example shows how to read the attributes of 4 OPC-UA nodes at once, and
// display the results.
class procedure ReadMultiple.Main;
var
Arguments: OleVariant;
Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
I: Cardinal;
ReadArguments1, ReadArguments2, ReadArguments3, ReadArguments4: _UAReadArguments;
Result: _UAAttributeDataResult;
Results: OleVariant;
begin
ReadArguments1 := CoUAReadArguments.Create;
ReadArguments1.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
ReadArguments1.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10853';
ReadArguments2 := CoUAReadArguments.Create;
ReadArguments2.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
ReadArguments2.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10845';
ReadArguments3 := CoUAReadArguments.Create;
ReadArguments3.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
ReadArguments3.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10304';
ReadArguments4 := CoUAReadArguments.Create;
ReadArguments4.EndpointDescriptor.UrlString := 'http://opcua.demo-this.com:51211/UA/SampleServer';
ReadArguments4.NodeDescriptor.NodeId.ExpandedText := 'nsu=http://test.org/UA/Data/;i=10389';
Arguments := VarArrayCreate([0, 3], varVariant);
Arguments[0] := ReadArguments1;
Arguments[1] := ReadArguments2;
Arguments[2] := ReadArguments3;
Arguments[3] := ReadArguments4;
// Instantiate the client object
Client := CoEasyUAClient.Create;
// Perform the operation
TVarData(Results).VType := varArray or varVariant;
TVarData(Results).VArray := PVarArray(Client.ReadMultiple(Arguments));
// Display results
for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
begin
Result := IInterface(Results[I]) as _UAAttributeDataResult;
if Result.Succeeded then
WriteLn('results(', I, ').AttributeData: ', Result.AttributeData.ToString)
else
WriteLn('results(', I, ') *** Failure: ', Result.ErrorMessageBrief);
end;
end;Setting username and password: At the beginning of opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...ck%20certificate%20status.html
(always switch to the "Object Pascal" example tab)
So you just need to combine parts of these two examples together.
Best regards
Please Log in or Create an account to join the conversation.
I need to set the user and password and read a list of OPC items.
What is the best way to get these data list?
Are there any example in Delphi?
Thanks,
Escarre
Please Log in or Create an account to join the conversation.
this is from the OPC Labs tech support.
What is it that you are trying to achieve?
The URL of the server is specified in method calls, sometimes directly, sometimes in the endpoint descriptor object. But I am not sure if that was your question.
Best regards
Please Log in or Create an account to join the conversation.
I'm a Delphi developer and I'm trying to set up the user and password information.
I saw you used TEasyUAClientConfiguration, but how do you set the URL server information?
Thanks,
Escarre
Please Log in or Create an account to join the conversation.
