Skip to main content

getEndpoints

Preliminary / Supporting
  • After dragging it to the Endpoint, use Constructor Actually establish a session.
  • For cross-service discovery, please use FindServers.

Signature​

public static List<EndpointDescription> getEndpoints(String endpointUrl);
public static List<EndpointDescription> getEndpoints(String endpointUrl, int timeoutMs);

Connect to the server in temporary SecureChannel (None mode), retrieve the endpoint list, and then disconnect immediately. No session required. Default timeout: 10 seconds.

EndpointDescription Field​

MethodsTypeNote
getEndpointUrl()StringActual endpoint URL
getSecurityMode()Enums.MessageSecurityModeNone / Sign / SignAndEncrypt
getSecurityPolicyUri()StringAlgorithm Suite URI
getServerCertificate()byte[]Server Certificate (DER)
getServerApplicationUri()StringServer Applications URI
getServerProductUri()StringServer Products URI
getServerApplicationName()StringServer Application Name
getServerApplicationType()int0=Server / 1=Client / 2=ClientAndServer / 3=DiscoveryServer
getUserTokens()List<UserTokenPolicy>Supported Login Methods
getTransportProfileUri()StringTransmission Profile (usually UA-TCP)
getSecurityLevel()byteServer-Side Recommendation Priority

UserTokenPolicy Field​

MethodsNote
getPolicyId()The ID provided by the server, which is sent back when the client is activated
getTokenType()Enums.UserTokenType Anonymous / Username / Certificate / Issued

Usage​

List<EndpointDescription> endpoints =
OpcUaDiscovery.getEndpoints("opc.tcp://server:4840");

System.out.println("Server has " + endpoints.size() + " endpoints:");
for (EndpointDescription ep : endpoints) {
System.out.println();
System.out.println(" URL: " + ep.getEndpointUrl());
System.out.println(" Mode: " + ep.getSecurityMode());
System.out.println(" Policy: " + ep.getSecurityPolicyUri());
System.out.println(" Tokens:");
for (UserTokenPolicy t : ep.getUserTokens()) {
System.out.println(" - " + t.getTokenType() + " (PolicyId=" + t.getPolicyId() + ")");
}
}

Sample Output​

Server has 4 endpoints:

URL: opc.tcp://server:4840
Mode: None
Policy: http://opcfoundation.org/UA/SecurityPolicy#None
Tokens:
- Anonymous

URL: opc.tcp://server:4840
Mode: Sign
Policy: http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
Tokens:
- Anonymous
- Username

URL: opc.tcp://server:4840
Mode: SignAndEncrypt
Policy: http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256
Tokens:
- Username
- Certificate

The server typically exposes multiple combinations (None / Sign / SignAndEncrypt× Anonymous / Username / Certificate), and the client selects the appropriate one based on its needs.

Exception​

ExceptionMeaning
OpcUaException(BadCommunicationError)Network / Server Unreachable
OpcUaException(BadServiceUnsupported)The server does not support Discovery (rare)

Next Step​