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.

set Basic128Rsa15 and User/Password on Xojo

More
14 Dec 2018 19:49 #6921 by support
Hello,
thanks for update.

If I have not missed something, the only difference between the last two code samples is ReadValue vs. ReadMultipleValues. The ReadValue is, however, just a wrapper around ReadMultipleValues, so this difference in the code does not explain the difference in behavior. I suspect the reason is somewhere else.

Best regards

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

More
14 Dec 2018 12:29 - 14 Dec 2018 19:46 #6920 by kristof2015
OK. I found the solution. Here is if someone need.
Code:
Dim GdsEndpointDescriptor As OLEObject GdsEndpointDescriptor = new OleObject("OpcLabs.EasyOpc.UA.UAEndpointDescriptor") GdsEndpointDescriptor.UrlString = "opc.tcp://172.17.2.120:4840" GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "User1" GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "Pass1" Dim EasyUa As OLEObject EasyUa = new OLEObject("OpcLabs.EasyOpc.UA.EasyUAClient") Dim Results() As Variant Dim sErr As String Dim ReadArgument1 As new OLEObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments") ReadArgument1.EndpointDescriptor = GdsEndpointDescriptor ReadArgument1.NodeDescriptor.NodeId.expandedText = "nsu=SinumerikVarProvider;ns=2;s=/Bag/State/opMode" Dim Arguments() As Variant Arguments.Append ReadArgument1 Dim Result As new OLEObject("OpcLabs.BaseLib.OperationModel.ValueResult") Dim iValue As Integer Try Results = EasyUa.ReadMultipleValues(Arguments) Result = Results(0) iValue = Result.Value("Value") Catch Err As OLEException sErr = Err.Message End Try
Last edit: 14 Dec 2018 19:46 by support.

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

More
14 Dec 2018 11:23 - 14 Dec 2018 19:46 #6919 by kristof2015
Hi,
Thank you for your response. I have tryed in many ways, egz.
Code:
Dim GdsEndpointDescriptor As OLEObject GdsEndpointDescriptor = new OleObject("OpcLabs.EasyOpc.UA.UAEndpointDescriptor") GdsEndpointDescriptor.UrlString = "opc.tcp://172.17.2.109:4840" GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "User1" GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "Pass1" Dim EasyUa As OLEObject EasyUa = new OLEObject("OpcLabs.EasyOpc.UA.EasyUAClient") Dim Result As Integer Try Result = EasyUa.ReadValue(GdsEndpointDescriptor,"nsu=SinumerikVarProvider;ns=2;s=/Bag/State/opMode") Catch Err As OLEException MsgBox(Err.Message) End Try
And I get the same Error:
Exception code 0: Status is not good: BadUserAccessDenied., (failed on "ReadValue")

What I do wrong?

Thank you,
Last edit: 14 Dec 2018 19:46 by support.

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

More
12 Dec 2018 13:16 #6911 by support
Hello.

As I wrote, there may be two issues - one is the communication security, and the other is the username/password.

Based on the error message you are getting (BadUserAccessDenied), let's start with the username/password first, because there is a chance that the communication security part is OK.

Here is the basic theory:
- you can set the user name and password in the UserIdentity.UserNameTokeInfo.UserName and .Password properties of the UAEndpointDescriptor.
- but in COM API (Xojo), there is no overload of the ReadValue method that would accept the UAEndpointDescriptor. You need to use ReadMultipleValues instead.

I do not have Xojo at hand right now, but here is VBScript example of putting together the UAEndpointDescriptor with username and password:
Code:
' 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"

And here are VB6 and VBScript examples that use ReadMultipleValues.

VB6:
Code:
OutputText = "" ' Instantiate the client object Dim Client As New EasyUAClient Dim ReadArguments1 As New UAReadArguments ReadArguments1.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" ReadArguments1.NodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/;i=10845" Dim ReadArguments2 As New UAReadArguments ReadArguments2.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" ReadArguments2.NodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/;i=10853" Dim ReadArguments3 As New UAReadArguments ReadArguments3.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" ReadArguments3.NodeDescriptor.NodeId.expandedText = "nsu=http://test.org/UA/Data/;i=10855" Dim arguments(2) As Variant Set arguments(0) = ReadArguments1 Set arguments(1) = ReadArguments2 Set arguments(2) = ReadArguments3 ' Obtain values. By default, the Value attributes of the nodes will be read. Dim results() As Variant results = Client.ReadMultipleValues(arguments) ' Display results Dim i: For i = LBound(results) To UBound(results) Dim Result As ValueResult: Set Result = results(i) OutputText = OutputText & "Value: " & Result.value & vbCrLf Next ' Example output: ' 'Value: 8 'Value: -8.06803E+21 'Value: Strawberry Pig Banana Snake Mango Purple Grape Monkey Purple? Blueberry Lemon^

VBScript:
Code:
' Instantiate the client object Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.UA.EasyUAClient") Dim ReadArguments1: Set ReadArguments1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments") ReadArguments1.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" ReadArguments1.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/;i=10845" Dim ReadArguments2: Set ReadArguments2 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments") ReadArguments2.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" ReadArguments2.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/;i=10853" Dim ReadArguments3: Set ReadArguments3 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments") ReadArguments3.EndpointDescriptor.UrlString = "http://opcua.demo-this.com:51211/UA/SampleServer" ReadArguments3.NodeDescriptor.NodeId.ExpandedText = "nsu=http://test.org/UA/Data/;i=10855" Dim arguments(2) Set arguments(0) = ReadArguments1 Set arguments(1) = ReadArguments2 Set arguments(2) = ReadArguments3 ' Obtain values. By default, the Value attributes of the nodes will be read. Dim results: results = Client.ReadMultipleValues(arguments) ' Display results Dim i: For i = LBound(results) To UBound(results) Dim ValueResult: Set ValueResult = results(i) WScript.Echo "Value: " & ValueResult.Value Next ' Example output: ' 'Value: 8 'Value: -8.06803E+21 'Value: Strawberry Pig Banana Snake Mango Purple Grape Monkey Purple? Blueberry Lemon^

With this at hand, you should be able to put together the Xojo code for it.
Let me know if this helps

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

More
12 Dec 2018 07:05 #6907 by kristof2015
Hi,
Thanks or fast answer.
Following QuickOPC Xojo example I have:

' Create EasyOPC-UA component
Dim Client As New OleObject ("OpcLabs.EasyOpc.UA.EasyUAClient")

Dim OpcUrl As String = "opc.tcp://172.17.2.106:4840"
Dim Node As String = "nsu=SinumerikVarProvider;ns=2;s=/Bag/State/opMode"
Dim sResult As String

sResult = Client.ReadValue(OpcUrl, node)

And this works fine. But on server which has included "none" in security mode.
When Server has, in this case "Basic128Rsa15" or any as on picture, user and password, than I dont know haw to set it up in Xojo code. In result gave me OLEException:
"Exception code 0: Status is not good: BadUserAccessDenied., (failed on "ReadValue")"
How can I define this?
Thanks,
Kris

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

More
12 Dec 2018 05:48 #6906 by support
Hello.

Have you studied the related documentation, mainly
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...me.html#OPC-UA%20Security.html ?

If you did, and still have a specific problem, please explain the problem according to Rules for Forum Posts: www.opclabs.com/forum/announcements12/2365-rules-for-forum-posts .

Also, please be aware that application/communication security is separate from user security in OPC UA. Therefore, when you say "how to set Basic128Rsa15 and User/Password", it can mean many things.

It mean, for example, that the communication is secured using Basic128Rsa15, and on top of that, username/passwords authentication is used. Or, it can be that communication itself is not secured, but user still authenticate using username/password, and the token is secured using Basic128Rsa15. Clarify this as well. If you do not fully understand, that's fine too, just give us as much info as you can.

Best regards

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

More
12 Dec 2018 05:43 #6905 by support
From: D.
Sent: Wednesday, December 12, 2018 1:52 AM
To: Z.
Subject: Ask for support

Dear Z.,
As until now we didn’t have problems with connect to OPC Server I didn’t contact for support.
Now Server is using Basic128Rsa15 And User/Password authentication.

Language we use is XOJO.
Can you please help how to set Basic128Rsa15 and User/Password on Xojo.

Thank you,
Best regards,
K.

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

Moderators: supportvaclav.zaloudek
Time to create page: 0.146 seconds