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.

Authentication with username and password with Visual FoxPro

More
07 Dec 2021 20:15 #10435 by support
Thanks for update, I am glad it is resolved.

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.

More
07 Dec 2021 16:48 #10434 by info@software2000.it
thanks a lot
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
The following user(s) said Thank You: support

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

More
07 Dec 2021 07:31 #10430 by support
Hello.

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.

More
06 Dec 2021 14:41 #10429 by info@software2000.it
Thanks for the reply; I tried to insert the code you reported to me, it does not give me any error, but I cannot read the value of the node, I would expect to find a False value, as correctly I receive if I read everything through the "Connectivity Explorer" example application . I don't know what to do / where am I wrong anymore.

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
Attachments:

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

More
04 Dec 2021 09:20 #10425 by support
Yes.

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"
Best regards

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

More
04 Dec 2021 09:18 #10424 by support
From: M.
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.

More
02 Dec 2021 17:57 - 02 Dec 2021 17:57 #10423 by support
Hello.

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"
Best regards
Last edit: 02 Dec 2021 17:57 by support.

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

More
02 Dec 2021 16:37 - 02 Dec 2021 17:57 #10422 by info@software2000.it
Dear Sirs,

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
Last edit: 02 Dec 2021 17:57 by support.

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

Moderators: support
Time to create page: 0.070 seconds