GetEndpoints Failed error when connecting to an OPCUA simulation server
33 ビュー (過去 30 日間)
古いコメントを表示
I am trying to configure a setup to retrieve data from the IntegrationObject simulation server. I am able to store data in it from a remote host using pyhton. I can also connect to the server as long as I am running MATLAB 2022b in the same host. But when it comes to connect to the server from another remote host using MATLAB 2022b it fires an internal error saying it cannot retrieve the Endpoints
>> s=opcuaserverinfo('u114193')
s =
OPC UA ServerInfo 'Integration Objects UA Server Simulator':
Connection Information:
Hostname: 'u114193'
Port: 62640
Endpoints: [1×5 opc.ua.EndpointDescription]
Security Information:
BestMessageSecurity: SignAndEncrypt
BestChannelSecurity: Basic256Sha256
UserTokenTypes: {'Anonymous' 'Username' 'Certificate'}
>> uac=opcua(s)
uac =
OPC UA Client:
Server Information:
Name: 'Integration Objects UA Server Simulator'
Hostname: 'u114193'
Port: 62640
EndpointUrl: 'opc.tcp://localhost:62640/IntegrationObjects/ServerSimulator'
Connection Information:
Timeout: 10
Status: 'Disconnected'
ServerState: '<Not connected>'
Security Information:
MessageSecurityMode: SignAndEncrypt
ChannelSecurityPolicy: Basic256Sha256
Endpoints: [1×5 opc.ua.EndpointDescription]
>> connect(uac,'opcua_user','mipass')
Error using matlabshared.asyncio.internal.MessageHandler/onError
GetEndpoints Failed.
Error in matlabshared.asyncio.internal.Channel/open (line 275)
obj.ChannelImpl.open(options);
Error in opc.ua.Client/connect (line 567)
clnt.AsyncChannel.open(options);
Username and password are correct. Anonymous access gives the same result. Using the EndpintURL does not help either from the remote host. I have notice that the endpointURL refers to localhost, but the hostname is ok, so I presume It trys to conenect to the remote host.
I can browse the server from any machine using various 3th party OPCUA browsers, Firewall is off
If using the IP of the server, I get the same result, but anyhow, I have updated C:\Windows\System32\drivers\etc\hosts with the correspondig entry for host u114193
I have also followed the instructions to allow DCOM with no security but this prevented my win10 64 bit from booting correctly (https://es.mathworks.com/help/icomm/ug/preparing-to-use-opc-toolbox-software.html)
any hint on this issue will be greatly appreciated?
Best regards.
0 件のコメント
回答 (2 件)
Srijith Vijay
2024 年 3 月 1 日
Hi Jose,
This is usually caused by the server returning an endpoint URL that contains an unreachable hostname. Unlike other 3rd party apps, MATLAB does not replace the hostname in the endpoint/discovery URLs returned by the server to prevent secuirty issues.
To help you debug this further, you could use a packet analyzer tool like Wireshark to log OPC UA packets after executing the following command:
uac = opcua("u114193",62640);
Once you have the log, filter the Wireshark log to view only OPC UA packets and then see what is the Endpoint URL received from the server in the "FindServersReponse" and "GetEndpointResponse" packets. See if this contains the expected hostname.
You can refer to this link to setup Wireshark to capture and filter OPC UA packets: Analyzing OPC UA Communications with Wireshark – OPC Connect (opcfoundation.org)
If "u114193" should be the hostname in the endpoint/discovery URLs, then you will need to configure your OPC UA server to return an endpoint/discovery URL that contains this hostname.
5 件のコメント
Srijith Vijay
2024 年 5 月 20 日
Jose,
I meant UA expert would ideally issue a confirmation warning (as below) when you add the server for the first time. Not when you connect an existing client.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1698846/image.png)
Also, replacing "localhost" with your system hostname (u114193) in the endpoint URL information of "opcua" function is not sufficient. There are other inaccessible portions of code that uses the exact endpoint URL containing "localhost" returned by your OPC UA server. This is why the connect function is failing for you eventhough the opcua function goes through.
The issue here stems from the fact that your OPC UA server is configured to return "localhost" instead of "u114193" as hostname, in the endpoint URL it returns. And it would be a secuirty concern fro the MATLAB client to override the endpoint info returned by the server.
I'd recommend reaching out to us at Product Usage (mathworks.com) so that we can help you debug this issue further and possibly fix it.
Meanwhile, you could also try using the machine's IP address instead of hostname in opcua function, after confirming that both localhost and u114193 are mapped to the corresponding machine IP address in etc/hosts file.
Narvik
2023 年 11 月 24 日
編集済み: Narvik
2024 年 3 月 1 日
Hi,
I understand that you are facing an issue while trying to connect to an OPC server. Retrieving endpoints might fail when the endpoint URL(s) returned by the server is incorrect and the server can't be reached at that address.
You can refer to the following MATLAB answer to avoid issues with retrieving endpoints:
Hope this helps!
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!