OPC UA Endpoints error
11 views (last 30 days)
Show older comments
Alex Serrat
on 23 Mar 2022
Answered: MathWorks Industrial Communication Toolbox Team
on 25 Sep 2023
I am trying out the Industrial Communication Toolbox in matlab to read the datapoints from an OPC UA server running in my PLC. I used the demoUA_browsing file to test, but it gives me errors. The hostname is the IP address of my Beckhoff PLC (which works).
serverList = opcuaserverinfo('opc.tcp://hostname:4840')
responds with:
serverList =
OPC UA ServerInfo 'TcOpcUaServer@hostname':
Connection Information:
Hostname: 'hostname'
Port: 4840
Endpoints: [0×0 opc.ua.EndpointDescription]
Security Information:
BestMessageSecurity: Unknown
BestChannelSecurity: Unknown
UserTokenTypes: {1×0 cell}
but it is not able to retrieve the endpoints... Due to that when I then run the command:
uaClient = opcua(serverList)
I get the following error:
Error using opc.ua.Client/fetchEndpoints (line 684)
The operation timed out.
Error in opc.ua.Client (line 378)
[~, appName] = this(tI).fetchEndpoints;
Error in opcua (line 43)
uaObj = opc.ua.Client(varargin{:});
Error in demoUA_browsing (line 34)
uaClient = opcua(serverList)
I also have UaExpert to make sure that the communication is okay, and it is able to connect and read/write all the values. Any ideas?
1 Comment
Pete
on 12 Aug 2022
The server name returned from opc.internal.opcUaDiscovery findserver does not match the address in the original opc url. This can happen when the server url is an ipaddress and the server name is an actual name. For a Windows machine the ipaddress can be mapped to a server name in the file called hosts located in C:\Windows\System32\drivers\etc\. You will add something like:
xxx.xxx.xx.xxx <youropcusservername> # source server
That worked for me to resolve the endpoints.
Answers (1)
MathWorks Industrial Communication Toolbox Team
on 25 Sep 2023
This issue arises when the OPC UA Server includes certificates with endpoints that cannot be accessed by the client, particularly when the client connects through multiple interfaces.
You can find more info in the below MATLAB Answer:
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!