- Posts: 19
- Thank you received: 1
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.
Erro connecting to UA Server
Attachments:
Please Log in or Create an account to join the conversation.
thank you.
Earlier you wrote " I used Matrikon application and I can access to the data.". With Matrikon client, can you check whether your connection has been made "insecure" (no signing, no encryption), or secure?
The reason I am asking is that your code currently uses the insecure connection. And, some servers are configured to reject the username/password user identity token on unencrypted connections. So, if the test with Matrikon was using am encrypted connection, that could explain it.
Regards
Please Log in or Create an account to join the conversation.
My code:
EasyUAClientConfiguration := TEasyUAClientConfiguration.Create(nil);
UserIdentity := TUserIdentity.Create(nil);
try
UserIdentity.UserNameTokenInfo.UserName := strUser;
Useridentity.UserNameTokenInfo.Password := strPass;
EasyUAClientConfiguration.AdaptableParameters.SessionParameters.UserIdentity := Useridentity.DefaultInterface;
EasyUAClientConfiguration.AdaptableParameters.SessionParameters.HoldPeriod := 60000;
EasyUAClientConfiguration.RemoteMachineName := strOPCServer;
EasyUAClientConfiguration.AdaptableParameters.SessionParameters.EndpointSelectionPolicy.AllowedMessageSecurityModes := UAMessageSecurityModes_All;
EasyUAClientConfiguration.SharedParameters.EngineParameters.CertificateAcceptancePolicy.AcceptAnyCertificate := True;
EasyUAClientConfiguration.Connect;
finally
UserIdentity.Free;
EasyUAClientConfiguration.Free;
end;
I get all the nodes to a list of Arguments in an object.
ReadArgument := CoUAReadArguments.Create;
ReadArgument.EndpointDescriptor.UrlString := strOPCServer;
ReadArgument.NodeDescriptor.NodeId.ExpandedText := strRoot+ ThisVariable.OPCItem;
ReadArgument.AttributeId := UAAttributeId_DataType;
Machine.ArgumentsIni[intVariableActual] := ReadArgument;
// Activate DataChange
Machine.ClienteOPCUA.SubscribeDataChange(ReadArgument.EndpointDescriptor.UrlString, ReadArgument.NodeDescriptor.NodeId.ExpandedText, 2000);
But i use the Connectivity Explorer tool and configured the EndPoint and I get the errors I sent in the original post.
Thanks.
escarre
Please Log in or Create an account to join the conversation.
thank you.
Please post here the pieces of code that you use and that show how you create the UAEndpointDescriptor with the username and password. You can redact the sensitive information out, of course.
Best regards
Please Log in or Create an account to join the conversation.
1. Yes, I used the username and password configured by the Opc-UA Server admin.
2. The target is and OPC UA EndPoint. Then I configure en User identity as EndPoint parameters, settint the user and password.
3. I used Matrikon application and I can access to the data.
Best regards,
escarre
Please Log in or Create an account to join the conversation.
First I should not that we do not officially support older software versions. I will still try to help but only to reasonable extent.
Please answer:
1) Is it my correct understanding that you are using username/password to authenticate the user to the server?
2) What target OPC server are you connecting to?
3) Have yo used other OPC UA client to connect to the server, with username/password? What were the results?
Regards
Please Log in or Create an account to join the conversation.
I'm tryng to connect to a OPC-UA Server and it's not working.
Y used the Connectivity Explorer tool and cofigured the endpoint, the user/password data and get the same error.
I paste here the error:
EXCEPTION 1
Exceptions
Type: OpcLabs.BaseLib.Browsing.BrowseException
Data:
HelpLink:
HResult: -2146233088 (0x80131500)
InnerException:
OpcLabs.EasyOpc.UA.UAServiceException: OPC-UA service result - (no description available) = BadIdentityTokenInvalid.
---- SERVICE RESULT ----
Status Code: {BadIdentityTokenInvalid} = 0x80200000 (2149580800)
+ The SDK action called was "static Session.Create".
+ Following (18) events were gathered during the action on activity ID [31], in the order of first occurrence:
SDK trace: CreateSession Called. RequestHandle=1, PendingRequestCount=1
[18] SDK trace: Token #0 created. CreatedAt = 10:43:12.813 . Lifetime = 3600000
[18] SDK trace: SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.03.342.0] [ID=1009] Connected To: opc.tcp://192.168.52.91:4840/ [None/None/Binary]
[18] SDK trace: Token #1 activated. CreatedAt = 10:43:12.813 . Lifetime = 3600000
SDK trace: CreateSession Completed. RequestHandle=1, PendingRequestCount=0
SDK trace: Revised session timeout value: 60000.
SDK trace: Max response message size value: 4194304. Max request message size: 0
SDK trace: ActivateSession Called. RequestHandle=2, PendingRequestCount=1
SDK trace: ***EXCEPTION*** BadIdentityTokenInvalid
SDK trace: ActivateSession Completed. RequestHandle=2, PendingRequestCount=0, StatusCode=Bad
SDK trace: CloseSession Called. RequestHandle=3, PendingRequestCount=1
SDK trace: CloseSession Completed. RequestHandle=3, PendingRequestCount=0
[18] SDK trace: TCPCLIENTCHANNEL SOCKET CLOSED: 00000948, ChannelId=1009
Exception: {Opc.Ua.ServiceResultException} BadSecureChannelClosed
SDK trace: CloseSession Called. RequestHandle=4, PendingRequestCount=1
2*Exception: {System.ObjectDisposedException} Cannot access a disposed object.
SDK trace: CloseSession Completed. RequestHandle=4, PendingRequestCount=0, StatusCode=Bad
+ Events starting with activity ID in [] may not necessarily be related to the current action.
+ The client method called was 'BrowseMultiple'.
Data:
7b4d9f28-22a8-41d6-93ea-e4d8c2a75da8:
((31, 1), Opc.Ua.TraceEventArgs)
((18, 0), Opc.Ua.TraceEventArgs)
((18, 0), Opc.Ua.TraceEventArgs)
((18, 0), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((18, 0), Opc.Ua.TraceEventArgs)
((31, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((31, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((31, 1), Opc.Ua.TraceEventArgs)
((31, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((31, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
OpcLabs.EasyOpc.UA.Internal.ExceptionEnhancingEasyUAClient.Processed: True
Help Link:
at Opc.Ua.ClientBase.ValidateResponse(ResponseHeader header)
at Opc.Ua.SessionClient.ActivateSession(RequestHeader requestHeader, SignatureData clientSignature, SignedSoftwareCertificateCollection clientSoftwareCertificates, StringCollection localeIds, ExtensionObject userIdentityToken, SignatureData userTokenSignature, Byte[]& serverNonce, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos)
at OpcLabs.EasyOpc.UA.Sdk.Shims.SessionShim.ActivateSession(RequestHeader requestHeader, SignatureData clientSignature, SignedSoftwareCertificateCollection clientSoftwareCertificates, StringCollection localeIds, ExtensionObject userIdentityToken, SignatureData userTokenSignature, Byte[]& serverNonce, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos)
at Opc.Ua.Client.Session.Open(String sessionName, UInt32 sessionTimeout, IUserIdentity identity, IList`1 preferredLocales, Boolean checkDomain)
at OpcLabs.EasyOpc.UA.Sdk.Shims.SessionShim.Create(ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, Boolean updateBeforeConnect, Boolean checkDomain, String sessionName, UInt32 millisecondsSessionTimeout, Func`2 identityFunction, IList`1 preferredLocales, Action`2 domainCheckError, Action`1 setupSession, Action`1 setupTransportChannel)
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSessionBase.<>c__DisplayClass149_0.<CreateSdkSession>b__2()
at OpcLabs.EasyOpc.UA.Toolkit.UAEngineBase.PerformSdkAction(UASdkCallType callType, Func`1 usingFunction, String name, Action sdkAction)
HResult: -2146232832 (0x80131600)
InnerException:
Internal Code: 2149580800
Message:
OPC-UA service result - (no description available) = BadIdentityTokenInvalid.
---- SERVICE RESULT ----
Status Code: {BadIdentityTokenInvalid} = 0x80200000 (2149580800)
+ The SDK action called was "static Session.Create".
+ Following (18) events were gathered during the action on activity ID [31], in the order of first occurrence:
SDK trace: CreateSession Called. RequestHandle=1, PendingRequestCount=1
[18] SDK trace: Token #0 created. CreatedAt = 10:43:12.813 . Lifetime = 3600000
[18] SDK trace: SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.03.342.0] [ID=1009] Connected To: opc.tcp://192.168.52.91:4840/ [None/None/Binary]
[18] SDK trace: Token #1 activated. CreatedAt = 10:43:12.813 . Lifetime = 3600000
SDK trace: CreateSession Completed. RequestHandle=1, PendingRequestCount=0
SDK trace: Revised session timeout value: 60000.
SDK trace: Max response message size value: 4194304. Max request message size: 0
SDK trace: ActivateSession Called. RequestHandle=2, PendingRequestCount=1
SDK trace: ***EXCEPTION*** BadIdentityTokenInvalid
SDK trace: ActivateSession Completed. RequestHandle=2, PendingRequestCount=0, StatusCode=Bad
SDK trace: CloseSession Called. RequestHandle=3, PendingRequestCount=1
SDK trace: CloseSession Completed. RequestHandle=3, PendingRequestCount=0
[18] SDK trace: TCPCLIENTCHANNEL SOCKET CLOSED: 00000948, ChannelId=1009
Exception: {Opc.Ua.ServiceResultException} BadSecureChannelClosed
SDK trace: CloseSession Called. RequestHandle=4, PendingRequestCount=1
2*Exception: {System.ObjectDisposedException} Cannot access a disposed object.
SDK trace: CloseSession Completed. RequestHandle=4, PendingRequestCount=0, StatusCode=Bad
+ Events starting with activity ID in [] may not necessarily be related to the current action.
+ The client method called was 'BrowseMultiple'.
Service result: BadIdentityTokenInvalid
Additional Info:
Description:
Inner result:
Qualified Symbolic ID:
Expanded Text:
IsNull: True
Name:
Namespace Index: 0
Namespace URI String:
Standard Name:
Status Code: BadIdentityTokenInvalid
Code Bits: 32800
Condition: 32
Flag Bits: 0
Has Data Value Info: False
Info type: NotUsed
Internal Value: 2149580800
Is Bad: True
Is Good: False
Is Uncertain: False
Limit Info: None
Overflow: False
Semantics Changed: False
Severity: BadOrFailure
Status Info: Error
Structure Changed: False
Text:
Status Code: {BadIdentityTokenInvalid} = 0x80200000 (2149580800)
Service Target Site: Void ValidateResponse(Opc.Ua.ResponseHeader)
DeclaringType: Opc.Ua.ClientBase
Module: Opc.Ua.Core.dll
Assembly: Opc.Ua.Core, Version=1.3.342.0, Culture=neutral, PublicKeyToken=6faddca41dacb409
CustomAttributes:
FullyQualifiedName: <Unknown>
MDStreamVersion: 131072
MetadataToken: 1
ModuleHandle: System.ModuleHandle
MDStreamVersion: 131072
ModuleVersionId: 1c0fd7d8-c25e-4e60-82cf-8ccb87577148
Name: <Unknown>
ScopeName: Opc.Ua.Core.dll
Source:
Stack Trace: Opc.Ua.Core
TargetSite:
Message: Problem browsing OPC Unified Architecture nodes.
Source:
StackTrace:
TargetSite:
EXCEPTION 2
Exceptions
Type: OpcLabs.BaseLib.Browsing.BrowseException
Data:
HelpLink:
HResult: -2146233088 (0x80131500)
InnerException:
OpcLabs.EasyOpc.UA.UAServiceException: OPC-UA service result - (no description available) = BadIdentityTokenInvalid.
---- SERVICE RESULT ----
Status Code: {BadIdentityTokenInvalid} = 0x80200000 (2149580800)
+ The SDK action called was "static Session.Create".
+ Following (18) events were gathered during the action on activity ID [14], in the order of first occurrence:
SDK trace: CreateSession Called. RequestHandle=1, PendingRequestCount=1
[15] SDK trace: Token #0 created. CreatedAt = 11:36:04.238 . Lifetime = 3600000
[23] SDK trace: SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.03.342.0] [ID=1433] Connected To: opc.tcp://192.168.52.91:4840/ [None/None/Binary]
[23] SDK trace: Token #1 activated. CreatedAt = 11:36:04.238 . Lifetime = 3600000
SDK trace: CreateSession Completed. RequestHandle=1, PendingRequestCount=0
SDK trace: Revised session timeout value: 60000.
SDK trace: Max response message size value: 4194304. Max request message size: 0
SDK trace: ActivateSession Called. RequestHandle=2, PendingRequestCount=1
SDK trace: ***EXCEPTION*** BadIdentityTokenInvalid
SDK trace: ActivateSession Completed. RequestHandle=2, PendingRequestCount=0, StatusCode=Bad
SDK trace: CloseSession Called. RequestHandle=3, PendingRequestCount=1
SDK trace: CloseSession Completed. RequestHandle=3, PendingRequestCount=0
[23] SDK trace: TCPCLIENTCHANNEL SOCKET CLOSED: 000011C8, ChannelId=1433
Exception: {Opc.Ua.ServiceResultException} BadSecureChannelClosed
SDK trace: CloseSession Called. RequestHandle=4, PendingRequestCount=1
2*Exception: {System.ObjectDisposedException} Cannot access a disposed object.
SDK trace: CloseSession Completed. RequestHandle=4, PendingRequestCount=0, StatusCode=Bad
+ Events starting with activity ID in [] may not necessarily be related to the current action.
+ The client method called was 'BrowseMultiple'.
Data:
7b4d9f28-22a8-41d6-93ea-e4d8c2a75da8:
((14, 1), Opc.Ua.TraceEventArgs)
((15, 0), Opc.Ua.TraceEventArgs)
((23, 0), Opc.Ua.TraceEventArgs)
((23, 0), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((23, 0), Opc.Ua.TraceEventArgs)
((14, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((14, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((14, 1), Opc.Ua.TraceEventArgs)
((14, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
((14, 1), System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs)
OpcLabs.EasyOpc.UA.Internal.ExceptionEnhancingEasyUAClient.Processed: True
Help Link:
at Opc.Ua.ClientBase.ValidateResponse(ResponseHeader header)
at Opc.Ua.SessionClient.ActivateSession(RequestHeader requestHeader, SignatureData clientSignature, SignedSoftwareCertificateCollection clientSoftwareCertificates, StringCollection localeIds, ExtensionObject userIdentityToken, SignatureData userTokenSignature, Byte[]& serverNonce, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos)
at OpcLabs.EasyOpc.UA.Sdk.Shims.SessionShim.ActivateSession(RequestHeader requestHeader, SignatureData clientSignature, SignedSoftwareCertificateCollection clientSoftwareCertificates, StringCollection localeIds, ExtensionObject userIdentityToken, SignatureData userTokenSignature, Byte[]& serverNonce, StatusCodeCollection& results, DiagnosticInfoCollection& diagnosticInfos)
at Opc.Ua.Client.Session.Open(String sessionName, UInt32 sessionTimeout, IUserIdentity identity, IList`1 preferredLocales, Boolean checkDomain)
at OpcLabs.EasyOpc.UA.Sdk.Shims.SessionShim.Create(ApplicationConfiguration configuration, ConfiguredEndpoint endpoint, Boolean updateBeforeConnect, Boolean checkDomain, String sessionName, UInt32 millisecondsSessionTimeout, Func`2 identityFunction, IList`1 preferredLocales, Action`2 domainCheckError, Action`1 setupSession, Action`1 setupTransportChannel)
at OpcLabs.EasyOpc.UA.Toolkit.UAClientSessionBase.<>c__DisplayClass149_0.<CreateSdkSession>b__2()
at OpcLabs.EasyOpc.UA.Toolkit.UAEngineBase.PerformSdkAction(UASdkCallType callType, Func`1 usingFunction, String name, Action sdkAction)
HResult: -2146232832 (0x80131600)
InnerException:
Internal Code: 2149580800
Message:
OPC-UA service result - (no description available) = BadIdentityTokenInvalid.
---- SERVICE RESULT ----
Status Code: {BadIdentityTokenInvalid} = 0x80200000 (2149580800)
+ The SDK action called was "static Session.Create".
+ Following (18) events were gathered during the action on activity ID [14], in the order of first occurrence:
SDK trace: CreateSession Called. RequestHandle=1, PendingRequestCount=1
[15] SDK trace: Token #0 created. CreatedAt = 11:36:04.238 . Lifetime = 3600000
[23] SDK trace: SECURE CHANNEL CREATED [TcpClientChannel UA-TCP 1.03.342.0] [ID=1433] Connected To: opc.tcp://192.168.52.91:4840/ [None/None/Binary]
[23] SDK trace: Token #1 activated. CreatedAt = 11:36:04.238 . Lifetime = 3600000
SDK trace: CreateSession Completed. RequestHandle=1, PendingRequestCount=0
SDK trace: Revised session timeout value: 60000.
SDK trace: Max response message size value: 4194304. Max request message size: 0
SDK trace: ActivateSession Called. RequestHandle=2, PendingRequestCount=1
SDK trace: ***EXCEPTION*** BadIdentityTokenInvalid
SDK trace: ActivateSession Completed. RequestHandle=2, PendingRequestCount=0, StatusCode=Bad
SDK trace: CloseSession Called. RequestHandle=3, PendingRequestCount=1
SDK trace: CloseSession Completed. RequestHandle=3, PendingRequestCount=0
[23] SDK trace: TCPCLIENTCHANNEL SOCKET CLOSED: 000011C8, ChannelId=1433
Exception: {Opc.Ua.ServiceResultException} BadSecureChannelClosed
SDK trace: CloseSession Called. RequestHandle=4, PendingRequestCount=1
2*Exception: {System.ObjectDisposedException} Cannot access a disposed object.
SDK trace: CloseSession Completed. RequestHandle=4, PendingRequestCount=0, StatusCode=Bad
+ Events starting with activity ID in [] may not necessarily be related to the current action.
+ The client method called was 'BrowseMultiple'.
Service result: BadIdentityTokenInvalid
Additional Info:
Description:
Inner result:
Qualified Symbolic ID:
Expanded Text:
IsNull: True
Name:
Namespace Index: 0
Namespace URI String:
Standard Name:
Status Code: BadIdentityTokenInvalid
Code Bits: 32800
Condition: 32
Flag Bits: 0
Has Data Value Info: False
Info type: NotUsed
Internal Value: 2149580800
Is Bad: True
Is Good: False
Is Uncertain: False
Limit Info: None
Overflow: False
Semantics Changed: False
Severity: BadOrFailure
Status Info: Error
Structure Changed: False
Text:
Status Code: {BadIdentityTokenInvalid} = 0x80200000 (2149580800)
Service Target Site: Void ValidateResponse(Opc.Ua.ResponseHeader)
DeclaringType: Opc.Ua.ClientBase
Module: Opc.Ua.Core.dll
Assembly: Opc.Ua.Core, Version=1.3.342.0, Culture=neutral, PublicKeyToken=6faddca41dacb409
CustomAttributes:
FullyQualifiedName: <Unknown>
MDStreamVersion: 131072
MetadataToken: 1
ModuleHandle: System.ModuleHandle
MDStreamVersion: 131072
ModuleVersionId: 1c0fd7d8-c25e-4e60-82cf-8ccb87577148
Name: <Unknown>
ScopeName: Opc.Ua.Core.dll
Source:
Stack Trace: Opc.Ua.Core
TargetSite:
Message: Problem browsing OPC Unified Architecture nodes.
Source:
StackTrace:
TargetSite:
I use OPC Labs tools, version 2018.3 (5.54.1026.1), in Delphi 11.
I need an answer as soon as possible, please.
Best Regards,
Escarre
Please Log in or Create an account to join the conversation.