This is archived documentation for an older version of Nirvana (v3.1). Please refer to documentation for the latest version if required.

Using Nirvana over HTTP/HTTPS

The Nirvana messaging APIs provides a rich set of functionality that can be used over sockets, SSL, HTTP and HTTPS. The code used to connect to the Nirvana server is the same regardless of which network protocol you are using to connect.

Under the Nirvana programming model there are a number of logical steps that need to be followed in order to establish a connection to a Nirvana sever (Realm). These involve establishing a session, obtaining a reference to a channel or a transaction, or registering an object as a subscriber. For more information please see our connecting to Nirvana FAQ.

Nirvana fully supports HTTP and HTTPS. Rather than tunnel an existing protocol through HTTP Nirvana has a plugable set of communications drivers supporting TCP/IP Sockets, SSL enabled TCP/IP sockets, HTTP and HTTPS. Both the client and server make use of these pluggable drivers. From the server perspective different driver types can be assigned to specific Nirvana interfaces. From a client perspective a Nirvana session can be built on any one of the available drivers dynamically.

Please note that before making an HTTP/HTTPS connection to a Nirvana realm server you will first need to add a HTTP/HTTPS interface to the realm .

To create a connect to a Nirvana Realm over HTTPS you would use an RNAME that specific the Nirvana HTTPS protocol (nhps) as follows:


1. Create a nSessionAttrib object with the RNAME value of your choice

//use an RNAME indicating the wire protocol you are using (HTTPS in this case)
//you can pass an array of up to four values for RNAME for added robustness
String[] RNAME=( { “nhps://remoteHost:443” } );
nSessionAttrib nsa = new nSessionAttrib( RNAME );

2. Call the create method on nSessionFactory to create your session

nSession mySession = nSessionFactory.create( nsa );

Alternatively, if you require the use of a session reconnect handler to intercept the automatic reconnection attempts, pass an instance of that class too in the create method:

Public class myReconnectHandler implements nReconnectHandler {

}

myReconnectHandler rhandler = new myReconnectHandler( );
nSession mySession = nSessionFactory.create( nsa, rhandler );

3. Initialise the session object to open the connection to the Nirvana Realm

mySession.init();


After initialising your Nirvana session, you will be connected to the Nirvana Realm using HTTPS. From that point, all functionality is subject to a Realm ACL check. If you call a method that requires a permission your credential does not have, you will receive an nSecurityException. Click here for more information on Nirvana ACLs.