Hello,
I opened a similar issue last time here :
www.opclabs.com/forum/ua-com-discovery-browsing/3358-delphi-set-endpointselectionpolicy
this time, for the same use case, i'm not trying to affect that value to the browsing dialog, but to my actual data collection service.
I'm getting access violation errors when trying to affect the EndpointSelectionPolicy.securityPolicyUriStr and i really don't know why.
here is a piece of my code for reference :
MonitoredItemArguments := CoEasyUAMonitoredItemArguments.Create;
MonitoredItemArguments.EndpointDescriptor.UrlString := OPCUAItemArgumentsList[I].endpoint;
MonitoredItemArguments.NodeDescriptor.NodeId.ExpandedText := OPCUAItemArgumentsList[I].node;
ReadItemArguments := CoUAReadArguments.Create;
ReadItemArguments.EndpointDescriptor.UrlString := OPCUAItemArgumentsList[I].endpoint;
ReadItemArguments.NodeDescriptor.NodeId.ExpandedText := OPCUAItemArgumentsList[I].node;
MonitoredItemArguments.EndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName := UserName;
MonitoredItemArguments.EndpointDescriptor.UserIdentity.UserNameTokenInfo.Password := Password;
//error occurs here
MonitoredItemArguments.EndpointDescriptor.EndpointSelectionPolicy.securityPolicyUriString := SecurityPolicy;
MonitoredItemArguments.EndpointDescriptor.EndpointSelectionPolicy.MessageSecurityModeName := MessageSecurityMode;
ReadItemArguments.EndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName := UserName;
ReadItemArguments.EndpointDescriptor.UserIdentity.UserNameTokenInfo.Password := Password;
ReadItemArguments.EndpointDescriptor.EndpointSelectionPolicy.securityPolicyUriString := SecurityPolicy;
ReadItemArguments.EndpointDescriptor.EndpointSelectionPolicy.MessageSecurityModeName := MessageSecurityMode;
i need this feature because some of the OPC servers i need to communicate with use explicit security policies.
I persist these security policy values on a config file, then feeds them to my data collection service for each endpoint it has to interface with.
It's probbaly a dumb error on my side but i'll admit i'm kinda lost here.
Thanks in advance.
Let me know if you need anything else.