public class SessionChannel extends ChannelService implements RequestChannel
It is fully safe to use session channel from different thread simultaneosly.
Session channel adds authentication token and time stamp to all requests.
| Modifier and Type | Class and Description |
|---|---|
static interface |
SessionChannel.RequestValidator
An optional listener, that can be set to the channel and allows modifying and rejecting
ServiceRequests sent to this channel. |
| Constructor and Description |
|---|
SessionChannel(Client client,
Session session,
SecureChannel channel)
Constructor for SessionChannel.
|
| Modifier and Type | Method and Description |
|---|---|
ActivateSessionResponse |
activate()
Activate session using anonymous access.
|
ActivateSessionResponse |
activate(byte[] issuedIdentityToken)
Activate session using identity token.
|
ActivateSessionResponse |
activate(String username,
String password)
Activate session using user name and password.
|
ActivateSessionResponse |
activate(UserIdentityToken identity,
SignatureData identitySignature,
boolean validateNonceLength,
boolean serverSupportsSecureUserTokenPolicy)
Activate session.
|
void |
close()
Close the session and the secure channel.
|
AsyncResult<SecureChannel> |
closeAsync()
Close the session and the secure channel asynchronously.
|
void |
closeSecureChannel()
Close the underlying secure channel.
|
void |
closeUnsafe()
Close the session and the secure channel.
|
void |
dispose()
dispose.
|
SessionChannel.RequestValidator |
getRequestValidator()
Returns the current request validator, or null if none is set.
|
SecureChannel |
getSecureChannel()
Get secure channel.
|
Session |
getSession()
Get the session.
|
<T extends ServiceResponse> |
serviceRequest(ServiceRequest<T> serviceRequest)
Invokes session service request.
|
<T extends ServiceResponse> |
serviceRequestAsync(ServiceRequest<T> request)
Asynchronous invocation of session service request.
|
SessionChannel.RequestValidator |
setRequestValidator(SessionChannel.RequestValidator validator)
Sets a new request validator, returns the old one or null if none was previously set.
|
ActivateSession, ActivateSession, ActivateSessionAsync, ActivateSessionAsync, AddNodes, AddNodes, AddNodesAsync, AddNodesAsync, AddReferences, AddReferences, AddReferencesAsync, AddReferencesAsync, Browse, Browse, BrowseAsync, BrowseAsync, BrowseNext, BrowseNext, BrowseNextAsync, BrowseNextAsync, Call, Call, CallAsync, CallAsync, Cancel, Cancel, CancelAsync, CancelAsync, CloseSecureChannel, CloseSecureChannel, CloseSecureChannelAsync, CloseSecureChannelAsync, CloseSession, CloseSession, CloseSessionAsync, CloseSessionAsync, CreateMonitoredItems, CreateMonitoredItems, CreateMonitoredItemsAsync, CreateMonitoredItemsAsync, CreateSession, CreateSession, CreateSessionAsync, CreateSessionAsync, CreateSubscription, CreateSubscription, CreateSubscriptionAsync, CreateSubscriptionAsync, DeleteMonitoredItems, DeleteMonitoredItems, DeleteMonitoredItemsAsync, DeleteMonitoredItemsAsync, DeleteNodes, DeleteNodes, DeleteNodesAsync, DeleteNodesAsync, DeleteReferences, DeleteReferences, DeleteReferencesAsync, DeleteReferencesAsync, DeleteSubscriptions, DeleteSubscriptions, DeleteSubscriptionsAsync, DeleteSubscriptionsAsync, FindServers, FindServers, FindServersAsync, FindServersAsync, FindServersOnNetwork, FindServersOnNetwork, FindServersOnNetworkAsync, FindServersOnNetworkAsync, GetEndpoints, GetEndpoints, GetEndpointsAsync, GetEndpointsAsync, HistoryRead, HistoryRead, HistoryReadAsync, HistoryReadAsync, HistoryUpdate, HistoryUpdate, HistoryUpdateAsync, HistoryUpdateAsync, ModifyMonitoredItems, ModifyMonitoredItems, ModifyMonitoredItemsAsync, ModifyMonitoredItemsAsync, ModifySubscription, ModifySubscription, ModifySubscriptionAsync, ModifySubscriptionAsync, OpenSecureChannel, OpenSecureChannel, OpenSecureChannelAsync, OpenSecureChannelAsync, Publish, Publish, PublishAsync, PublishAsync, QueryFirst, QueryFirst, QueryFirstAsync, QueryFirstAsync, QueryNext, QueryNext, QueryNextAsync, QueryNextAsync, Read, Read, ReadAsync, ReadAsync, RegisterNodes, RegisterNodes, RegisterNodesAsync, RegisterNodesAsync, RegisterServer, RegisterServer, RegisterServer2, RegisterServer2, RegisterServer2Async, RegisterServer2Async, RegisterServerAsync, RegisterServerAsync, Republish, Republish, RepublishAsync, RepublishAsync, SetMonitoringMode, SetMonitoringMode, SetMonitoringModeAsync, SetMonitoringModeAsync, SetPublishingMode, SetPublishingMode, SetPublishingModeAsync, SetPublishingModeAsync, setRequestChannel, SetTriggering, SetTriggering, SetTriggeringAsync, SetTriggeringAsync, TransferSubscriptions, TransferSubscriptions, TransferSubscriptionsAsync, TransferSubscriptionsAsync, TranslateBrowsePathsToNodeIds, TranslateBrowsePathsToNodeIds, TranslateBrowsePathsToNodeIdsAsync, TranslateBrowsePathsToNodeIdsAsync, UnregisterNodes, UnregisterNodes, UnregisterNodesAsync, UnregisterNodesAsync, Write, Write, WriteAsync, WriteAsyncpublic SessionChannel(Client client, Session session, SecureChannel channel)
Constructor for SessionChannel.
client - a Client object.session - a Session object.channel - a SecureChannel object.public ActivateSessionResponse activate() throws ServiceResultException
ServiceResultException - if errorpublic ActivateSessionResponse activate(byte[] issuedIdentityToken) throws ServiceResultException
issuedIdentityToken - tokenServiceResultException - if errorpublic ActivateSessionResponse activate(String username, String password) throws ServiceResultException
username - user namepassword - user passwordServiceResultException - if errorpublic ActivateSessionResponse activate(UserIdentityToken identity, SignatureData identitySignature, boolean validateNonceLength, boolean serverSupportsSecureUserTokenPolicy) throws ServiceResultException
identity - user identity, see
EndpointUtil#createIssuedIdentityToken(EndpointDescription, byte[], byte[])identitySignature - used with X509IdentityToken and IssuedIdentityToken ?validateNonceLength - serverSupportsSecureUserTokenPolicy - ServiceResultException - if errorpublic void close()
throws ServiceFaultException,
ServiceResultException
ChannelService.CloseSession(RequestHeader, Boolean) and
closeSecureChannel().ServiceResultException - if errorServiceFaultException - if errorpublic AsyncResult<SecureChannel> closeAsync()
Use close() to close the session before closing the session.
public void closeSecureChannel()
public void closeUnsafe()
close().public void dispose()
dispose.
public SessionChannel.RequestValidator getRequestValidator()
public SecureChannel getSecureChannel()
public Session getSession()
public <T extends ServiceResponse> T serviceRequest(ServiceRequest<T> serviceRequest) throws ServiceResultException
AuthenticationToken and Timestamp is added to RequestHeader.
If the operation timeouts or the thread is interrupted a ServiceResultException is thrown withStatusCodes.Bad_TimeoutserviceRequest in interface RequestChannelT - type of the response (determined automatically from the request).serviceRequest - the requestServiceResultException - if errorpublic <T extends ServiceResponse> AsyncResult<T> serviceRequestAsync(ServiceRequest<T> request)
AuthenticationToken and Timestamp is added to RequestHeader.
serviceRequestAsync in interface RequestChannelT - type of the response (determined automatically from the request).request - the requestpublic SessionChannel.RequestValidator setRequestValidator(SessionChannel.RequestValidator validator)
Copyright © 2026. All rights reserved.