Professional OPC
Development Tools

logos

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.

[Delphi] Set EndpointSelectionPolicy.securityPolicyUriStr

More
23 May 2022 13:04 #10882 by support
Hello,

I think you have diagnosed it yourself. The UAEndpointDescriptor.EndpointSelectionPolicy really is null (nil) by default. This has the effect of using a common policy from the session parameters. In order to set a policy specifically on your endpoint descriptor, simply create new UAEndpointSelectionPolicy object, set its properties, and then assign it to UAEndpointDescriptor.EndpointSelectionPolicy .


This should help, but if it does not, let me know.

Best regards

Please Log in or Create an account to join the conversation.

More
23 May 2022 12:53 #10881 by BAUMGARTNER
1. We're using 2020.2
2. Unfortunatly i don't have a helpful error message to provide. The error we're getting is an "Access violation at address xxxx" which is a typical unhelpful message in the delphi world. It's often raised when trying to access objets that aren't instanciated.

My current intuition is that in my example MonitoredItemArguments.EndpointDescriptor.EndpointSelectionPolicy isn't instantiated (nil value).
I know however that MonitoredItemArguments.EndpointDescriptor itself IS instantiated however because the previous lines affecting user and password values execute without error.

Please Log in or Create an account to join the conversation.

More
23 May 2022 09:10 #10880 by support
Hello,

I have some additional questions:

1. Which QuickOPC version are you using?
2. Please provide the full error message you are getting, and if there are other details to the error, then as much as possible...

Thank you

Please Log in or Create an account to join the conversation.

More
23 May 2022 08:24 #10879 by BAUMGARTNER
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.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.050 seconds