Код: Выделить всё
from opcua import Client, ua
opcClient = Client("opc.tcp://localhost:54321")
opcClient.connect;
valueNode = opcClient.get_node("ns=1;s=measure.value")
моя попытка подключения выглядит следующим образом:
Код: Выделить всё
OpcUaClient opcUaClient = new OpcUaClient(OpcUaClientConfig.builder().setEndpointUrl("opc.tcp://localhost:54321").build()).connect().get();
После дальнейшего исследования я нашел пример клиента на digital petris github страница,
https://github.com/kevinherron/ua-clien ... UaClientIT. java
после получения необходимых значений конфигурации с помощью скрипта Python я смог реплицировать часть, связанную с подключением клиента к серверу:
Код: Выделить всё
EndpointDescription[] endpoints = UaTcpStackClient.getEndpoints("opc.tcp://localhost:54321").get();
EndpointDescription endpoint = Arrays.stream(endpoints)
.filter(e -> e.getSecurityPolicyUri().equals(SecurityPolicy.None.getSecurityPolicyUri()))
.findFirst().orElseThrow(() -> new Exception("no desired endpoints returned"));
OpcUaClientConfig clientConfig = OpcUaClientConfig.builder()
.setApplicationName(LocalizedText.english("Pure Python Client"))
.setApplicationUri("urn:freeopcua:client")
.setEndpoint(endpoint)
.setRequestTimeout(uint(60000))
.build();
OpcUaClient client = new OpcUaClient(clientConfig);
Я пробовал добавить /discovery в конце URL-адреса (как рекомендуется). Система сертификатов отсутствует, и ожидается анонимный вход в систему.
Подробнее здесь: https://stackoverflow.com/questions/790 ... ital-petri