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.

block in CallMethod

More
19 May 2019 08:32 #7395 by support
Replied by support on topic block in CallMethod
Hello,

the fact that you need to use that extra code for making user authentication is weird. I will, however, investigate it later, because you seem to have a found a reliable workaround. I'd like to focus on the CallMethod issue first.

I have some questions.
1. Please send the full precise text of the timeout error.
2. With the code you have now, does it always time out, or only occasionally?

Thank you

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

More
18 May 2019 19:27 #7394 by kristof2015
Replied by kristof2015 on topic block in CallMethod
Hi, thanks for response.
I'm sure there is no prblem on server side. Works correctly on UAExpert and dataFEED OPC UA Client.
At the moment my solution was create separate executable to just launch the methods, and after its launch, kill the stucked exe.
Of course its temporary solution, willl not be delivered in final proyect. I need to find clean solution.

The code which works is:
Function call_method_opc_pallet(tPallet As Integer, tNode As String)
    Dim gdsEndpointDescriptor As UAEndpointDescriptor
    Dim Client As EasyUAClient
    On Error GoTo ErrHandler
 
    If tPallet < 1 And tPallet > 14 Then
        MsgBox ("Error Pallets: 1-14")
        Return
    End If
 
    Set gdsEndpointDescriptor = New UAEndpointDescriptor
    gdsEndpointDescriptor.UrlString = "opc.tcp://" + mHost + ":62542/RobotUAServer"
    gdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "admin"
    gdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "admin"
 
    Dim inputs(1) As Variant
    inputs(0) = tPallet
    inputs(1) = 9001
 
    Dim typeCodes(1) As Variant
    typeCodes(0) = 6 '(Byte)
    typeCodes(1) = 7 '(Int16)
 
    Set Client = New EasyUAClient
    Set Client.InstanceParameters.gdsEndpointDescriptor = gdsEndpointDescriptor
    Set Client.IsolatedParameters.SessionParameters.UserIdentity = gdsEndpointDescriptor.UserIdentity
    Client.Isolated = True
 
    Call Client.CallMethod(gdsEndpointDescriptor, "ns=2;s=Motion", tNode, inputs, typeCodes)
    Return
 
ErrHandler:
    MsgBox (Err.Description)
End Function

Its works because of this three lines added:
Set Client.InstanceParameters.gdsEndpointDescriptor = gdsEndpointDescriptor
    Set Client.IsolatedParameters.SessionParameters.UserIdentity = gdsEndpointDescriptor.UserIdentity
    Client.Isolated = True

After long time came error of timeout. 2min more or less.
With Anonymous authentication (on other server) "CallMethod" work fine.

Best regards,
Kristof

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

More
18 May 2019 14:03 #7393 by support
Replied by support on topic block in CallMethod
Alright, in order to figure out the issue with UserIdentity, I would have to see all parts of the code involved. But I guess that's not important at the moment, because you *somehow* got it running (although in a weird manner). Let's focus now on the CallMethod block.

Have you tried the same method with some other OPC UA client, and what were the results? The first thing I want to determine is whether the "block" isn't actually on the server. If it were on the server side, the CallMethod will actually return, but after quite long time (I think the default is 10 minutes, for OperationTimeout on the client side).

And that's another test I want you to make please. Please wait for approx. 11 minutes., and check whether the function returns or not. If it then returns with an error, what is the error?


Best regards

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

More
17 May 2019 14:47 #7390 by kristof2015
lClient.Isolated = True
lClient.IsolatedParameters.SessionParameters.UserIdentity = mEndPoint.UserIdentity

This is what changed.
If method is run like this it works, but app stuck and must be killed for continuing. Without came error as mentioned.
Best regards

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

More
17 May 2019 14:18 #7387 by support
Hello,

I am confused now. Earlier, you have provided an error message that you get from CallMethod. Now you report something different, but you have not stated what has changed - did the original error simply disappear by itself, or have you changed something in between, and if so, what?

Regards

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

More
17 May 2019 14:14 #7386 by kristof2015
Hi, thanks for your answer.
Its not a case. This code is working and its just set it as seperate.
But stuck completally. Execute method on server side but stuck. I must kill it to continue. So its not user/password and permisions issue.

Dim lClient As new OLEObject("OpcLabs.EasyOpc.UA.EasyUAClient")
mEndPoint = new OleObject("OpcLabs.EasyOpc.UA.UAEndpointDescriptor")
mEndPoint.UrlString = mHostUrl
mEndPoint.UserIdentity.UserNameTokenInfo.UserName = "admin"
mEndPoint.UserIdentity.UserNameTokenInfo.Password = "admin"

lClient.Isolated = True
lClient.IsolatedParameters.SessionParameters.UserIdentity = mEndPoint.UserIdentity
Outputs = lClient.CallMethod(mEndPoint, "ns=2;s=Motion", "ns=2;s=UnloadLoadingStation", inputs, typeCodes)

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

More
17 May 2019 14:00 #7384 by support
Hello.

It is possible that different users have different permissions, and some things works for one and do not for other. But, this is not the case here, for two reasons:
First, the error complains about unsupported user identity type, therefore the authentication does not even occur - the username/password is not supported by the specific server endpoint. Second, the cannot be any difference between read/write and method call, because the error comes from the UA session creation, which happens exactly the same way in both cases, *before* any read/write or method call can be performed. That is, at the moment you get the error, the server does not know what is going to follow, whether read/write or a method call - so it cannot "guess" when to work and when not.

I'd rather suspect that you are doing something different when doing read/write as opposed to method call. Can you place both these things (first any read/write, then method call) into the same piece of code and call them in sequence (and post the code here)? This would make sure they are both using the same parameters. Or (but that's not as hood), post here the code for read/write that works, so that it can be compared against the one that does method call.

Best regards

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

More
17 May 2019 13:13 #7383 by kristof2015
I get some more detailed error. Actually user and pass its correct, because I can read and write variables, only method doesnt work.

Exception code 0: OPC-UA service result - Endpoint does not supported the user identity type provided. = BadUserAccessDenied.
---- SERVICE RESULT ----
Status Code: {BadUserAccessDenied} = 0x801F0000 (2149515264)
Description: Endpoint does not supported the user identity type provided.
---- REMARKS ----
This error should mean an authorization (permissions) problem, not an authentication problem, but some servers are using it instead of rejecting the identity token (BadIdentityTokenRejected).
If you are identifying the client user by a user name token, it could be that the user name/password combination is incorrect.

+ The SDK action called was "static Session.Create".
+ This is a client-side error.
+ The client method called was 'CallMultipleMethods'., (failed on "CallMethod")

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

More
17 May 2019 11:46 #7381 by kristof2015
Hi, I have this code:

Function opc_call_pallet(Pallet As Integer)
Set GdsEndpointDescriptor = New UAEndpointDescriptor
GdsEndpointDescriptor.UrlString = "opc.tcp://192.168.240.235:62542"
GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.UserName = "admin"
GdsEndpointDescriptor.UserIdentity.UserNameTokenInfo.Password = "admin"

Dim inputs(1) As Variant
inputs(0) = Pallet
inputs(1) = 9001

Dim typeCodes(1) As Variant
typeCodes(0) = 6'Byte
typeCodes(1) = 7'Int16

'Dim Outputs(-1) As Variant
Set Client = New EasyUAClient
Call Client.CallMethod(GdsEndpointDescriptor, "ns=2;s=UnloadLoadingStation", "ns=2;s=Motion", inputs, typeCodes)

End Function

On server without user and password its works but when need it than always get this error:
Endpoint does not supported the user identity type provided.

Can somebody help me.
Thanks,
Kristof

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

Moderators: support
Time to create page: 0.064 seconds