Connection failure when using the WCF Siebel Adapter

I have seen quite a few instances where people run into issues while using the WCF Siebel adapter because of

 

a. Siebel Web Client is not installed correctly on the machine

b. Or the URI passed to the adapter, that eventually gets transformed to the connection string passed to Siebel, is incorrect

 

In order to eliminate the above 2 as possible causes, you can try out the following sample code that will use the Siebel COM interface to directly talk with Siebel (adapter is not involved). Please make sure you don’t see any error messages.

 

/// Application that will issue Login-Logoff request to Siebel

///

/// To run this program,

/// - Set ConnectString, Username and Password. ConnectString is of the format

/// siebel://host/EnterpriseServer/AppObjMgr/SiebelServer

/// (SiebelServer is required in case of Siebel 7.5)

/// For an example, please see the code below.

/// - Add a reference to sstchca.dll (found in siebel client install folder)

/// - Compile and run the program

/// - If the login fails, you will see an error message

using System;

using System.Runtime.InteropServices;

using SiebelBusObjectInterfaces;

namespace Sample

{

class Program

{

const string ConnectString = "host=\"siebel://adapsblsrvr77:2321/ent77/SSEObjMgr_enu";

const string Username = "abc";

const string Password = "def";

static void Main(string[] args)

{

SiebelDataControl sdc = null;

bool loggedIn = false;

try

{

/// Create a connection

sdc = new SiebelDataControl();

sdc.EnableExceptions(1);

sdc.Login(ConnectString, Username, Password);

loggedIn = true;

}

catch (COMException ex)

{

Console.WriteLine("ERROR: " + ex.ToString());

}

finally

{

if (sdc != null)

{

if (loggedIn)

{

sdc.Logoff();

}

Marshal.ReleaseComObject(sdc);

sdc = null;

}

}

Console.WriteLine("Press any key to terminate...");

Console.ReadLine();

}

}

}