Instantiating an MDEX Engine connection object

An AuthHttpENEConnection object is used to connect to the MDEX Engine.

An AuthHttpENEConnection connection functions as a repository for the hostname and port configuration for the MDEX Engine you want to query. The class methods are briefly described in the following sections. For more information on the methods, see the Endeca API Javadocs or the Endeca API Guide for .NET.

Java implementation

The signature for an AuthHttpENEConnection constructor looks like this:
//Instantiate a connection object for the MDEX Engine
AuthHttpENEConnection nec = new AuthHttpENEConnection(emeHost, emePort);

In the instantiation, emeHost is the host name or IP address of the Endeca MDEX Engine and emePort is its port number.

Use the AuthHttpENEConnection.enableSSL() method if you want to enable SSL for the connection:
//Instantiate a connection object for the MDEX Engine
AuthHttpENEConnection nec = new AuthHttpENEConnection(emeHost, emePort);
// Enable the SSL connection with our NullHostnameVerifier class
nec.setHostnameVerifier(new NullHostnameVerifier());
nec.enableSSL();

Note that at this time, an actual connection has not been opened to the MDEX Engine.

.NET implementation

For .NET, the ASPX code to instantiate an AuthHttpENEConnection object looks like this:
//Instantiate a connection object for the MDEX Engine
AuthHttpENEConnection nec = new AuthHttpENEConnection(emeHost, emePort);

In the instantiation, emeHost is the host name or IP address of the Endeca MDEX Engine and emePort is its port number.

If you want to enable SSL for the connection for a .NET application, use the AuthHttpENEConnection.EnableSSL() method:
// Set the MDEX Engine connection
AuthHttpENEConnection nec = new AuthHttpENEConnection(ENEHost, ENEPort);
// Create the X509 certificate from the DER version
X509Certificate privateCert =
   X509Certificate.CreateFromCertFile(@"C:\Endeca\MyCerts\eneCert.der");
// Enable SSL for the connection, using the new X509 certificate.
nec.EnableSSL(privateCert);
// Now update the certificate validation with a custom policy.
// Required because Endeca certificates throw Host Not Found exceptions.
ServicePointManager.CertificatePolicy = 
   new AcceptAllCertificatePolicy(privateCert);

At this time, an actual connection has not been opened to the MDEX Engine.