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
| Methods | Type | Note |
|---|---|---|
| getEndpointUrl() | String | Actual endpoint URL |
| getSecurityMode() | Enums.MessageSecurityMode | None / Sign / SignAndEncrypt |
| getSecurityPolicyUri() | String | Algorithm Suite URI |
| getServerCertificate() | byte[] | Server Certificate (DER) |
| getServerApplicationUri() | String | Server Applications URI |
| getServerProductUri() | String | Server Products URI |
| getServerApplicationName() | String | Server Application Name |
| getServerApplicationType() | int | 0=Server / 1=Client / 2=ClientAndServer / 3=DiscoveryServer |
| getUserTokens() | List<UserTokenPolicy> | Supported Login Methods |
| getTransportProfileUri() | String | Transmission Profile (usually UA-TCP) |
| getSecurityLevel() | byte | Server-Side Recommendation Priority |
UserTokenPolicy Field
| Methods | Note |
|---|---|
| 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
| Exception | Meaning |
|---|---|
| OpcUaException(BadCommunicationError) | Network / Server Unreachable |
| OpcUaException(BadServiceUnsupported) | The server does not support Discovery (rare) |