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
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.
- kristof2015
- Topic Author
- Offline
- Premium Member
- Posts: 11
- Thank you received: 0
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.
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.
- kristof2015
- Topic Author
- Offline
- Premium Member
- Posts: 11
- Thank you received: 0
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.
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.
- kristof2015
- Topic Author
- Offline
- Premium Member
- Posts: 11
- Thank you received: 0
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.
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.
- kristof2015
- Topic Author
- Offline
- Premium Member
- Posts: 11
- Thank you received: 0
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.
- kristof2015
- Topic Author
- Offline
- Premium Member
- Posts: 11
- Thank you received: 0
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.