Universal Messaging 10.3 | Concepts | Deployment | Client | Using HTTP/HTTPS
The Universal Messaging 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 Universal Messaging server is the same regardless of which network protocol you are using to connect.
Under the Universal Messaging programming model there are a number of logical steps that need to be followed in order to establish a connection to a Universal Messaging sever (Realm). These involve establishing a session, obtaining a reference to a channel or a transaction, or registering an object as a subscriber.
Universal Messaging fully supports HTTP and HTTPS. Rather than tunnel an existing protocol through HTTP Universal Messaging has a pluggable 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 Universal Messaging interfaces. From a client perspective a Universal Messaging session can be built on any one of the available drivers dynamically.
Please note that before making an HTTP/HTTPS connection to a Universal Messaging realm server you will first need to add a HTTP/HTTPS interface to the realm. See the Enterprise Manager documentation for details.
To create a connect to a Universal Messaging Realm over HTTPS you would use an RNAME (see Communication Protocols and RNAMEs) that specific the Universal Messaging 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 Universal Messaging Realm
After initialising your Universal Messaging session, you will be connected to the Universal Messaging 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.
For detailed information including code samples for connecting to Universal Messaging over HTTP/HTTPS please see our developer guides for the language you require.