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.
- Forum
- Discussions
- QuickOPC-UA in COM
- Reading, Writing, Subscriptions
- Authentication with username and password with Visual FoxPro
Authentication with username and password with Visual FoxPro
The code should check the .Exception for nullness anyway, because there are other possible errors that you cannot prevent.
Best regards
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
Indeed, the ErrorMessage property made me understand that the NodeId interrogated was incorrect, due to a code problem there was a terminal space.
thank you again
Please Log in or Create an account to join the conversation.
You should inspect the whole Valueresult.Item[0] - and specifically, the .Exception and .ErrorMessage properties.
There is no .Value if .Exception is non-null.
Best regards
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
Readarguments1 is a OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments type
ReadargumentsList is a OpcLabs.BaseLib.Collections.ElasticVector
I insert with ReadargumentsList.Add(Readarguments1) the value and the property ReadargumentsList.Count is correctly evaluated to 1 because I simulated only one value to read.
If I use Connectivity excplore the value of the node I read is : nsu=urn:Exor:OPCUAServer:JMobile ;ns=2;s=Tags.Carica_OPCUA
weith my program the value is the same
the property displaystring and toString of readarguments1 is :""opc.tcp://192.168.0.37:48008", "NodeId="nsu=urn:Exor:OPCUAServer:JMobile ;ns=2;s=Tags.Carica_OPCUA "", Value"
I store the result in Valueresult=oClient.ReadValueList(ReadArgumentsList) ///oClient is CREATEOBJECT("OpcLabs.EasyOpc.UA.EasyUAClient")
then I check Valueresult.Item[0] in this case because I added only one value to read, but the . Value property is blank and not false as I expected and as connectivity excplore return too.
Please help me
Please Log in or Create an account to join the conversation.
Or, you can manipulate these properties right where they are. Nothing forces you to create a new endpoint descriptor if you already have one. That was just an example. Using the code snippet you provided earlier, you could have something like
ReadArgument.EndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "user"
ReadArgument.EndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "1234"
Please Log in or Create an account to join the conversation.
Sent: Friday, December 3, 2021 4:05 PM
To: Z.
Subject: Re: Authentication with username and password with Visual FoxPro (Reading, Writing, Subscriptions)
Ok, thanks, but Can I pass rhis descrittor to the object I se for reading item (OpcLabs.EasyOpc.UA" .OperationModel.UAReadArguments)?
Thanks
Please Log in or Create an account to join the conversation.
The UserName and Password properties of UAEndpointDescriptor are not used in OPC UA authentication. You need different ones.
Below is an example of VBScript code that does that; converting to VFP should be straightforward.
' Define which GDS we will work with.
Dim GdsEndpointDescriptor: Set GdsEndpointDescriptor = CreateObject("OpcLabs.EasyOpc.UA.UAEndpointDescriptor")
GdsEndpointDescriptor.UrlString = "opc.tcp://opcua.demo-this.com:58810/GlobalDiscoveryServer"
GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "appadmin"
GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "demo"
Please Log in or Create an account to join the conversation.
- info@software2000.it
- Topic Author
- Offline
- Platinum Member
- Posts: 33
- Thank you received: 2
I would need to authenticate with user and password (the OPC-UA server requires it), to read a series of values by inserting them in an object of type "OpcLabs.BaseLib.Collections.ElasticVector" through the object "OpcLabs.EasyOpc.UA" .OperationModel.UAReadArguments "but I can't.
A snippet of what I do that does not return errors but does not read me the value.
This is an example of code I use, which works fine on servers without authentication.
oClient = CREATEOBJECT ("OpcLabs.EasyOpc.UA.EasyUAClient")
ReadArgumentsList = CreateObject ("OpcLabs.BaseLib.Collections.ElasticVector")
ReadArgument = CreateObject ("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
ReadArgument.EndpointDescriptor.UrlString = ....
///// String containing URL)
ReadArgument..NodeDescriptor.NodeId.ExpandedText = ....
////// string containing the Nodei ID)
ReadArgument.EndpointDescriptor.UserName = "user"
ReadArgument.EndpointDescriptor.Password = "1234"
Valueresult = oClient.ReadValueList (ReadArgumentsList)
result = Valueresult.Item [0] ///// assuming that I have only one value to read, obviously I have more for this use elasticvector)
result.Value should contain the read value of the requested NodeId, specifically a Boolean value but in reality it is always blank.
what am I doing wrong??
Help please
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-UA in COM
- Reading, Writing, Subscriptions
- Authentication with username and password with Visual FoxPro