Cognos SDK Guide by BI Centre can be purchased from PayPal.

You will have your own functional Cognos 8 SDK web solution that has been tailored to be scalable and flexible in order to adapt to your unique business requirements and solution architecture.


Monday, December 31, 2007

CognosSDK.cs -- Authentication

Authentication

The CognosLogon() method handles the authentication to the Cognos Report Service. This method permits a BIBus API value to be set and connected to Cognos 8. We have stored our authentication values in our web solution’s web.config file. We’ll discuss how to retrieve these values in the section named – web.config.

Here is the example code to authenticate a user to Cognos 8. The code is appending encoded xml with the stored values from the web.config file. The Content Manager service’s .logon() method is passed the encoded xml and it will return a valid CAMPassportId. If the user fails to be authenticated then an error message is passed to a string variable, which can then be displayed to the end user.

public string CognosLogon(contentManagerService1 cmService, string NmSpace,string uid, string pwd)
{
string CAMPassportID;
string credentialXML;
credentialXML= ""+ NmSpace + "";
credentialXML= credentialXML +"" + uid + "";
credentialXML= credentialXML +"" + pwd + "
";

try
{
xmlEncodedXML xmlPath = new xmlEncodedXML();
xmlPath.Value = credentialXML;
cmService.logon(xmlPath,new searchPathSingleObject[]{});
CAMPassportID = _cmService.biBusHeaderValue.CAM.CAMPassport.id.ToString();

return CAMPassportID;
}

catch (Exception ex)
{
return _ErrMsg = ex.Message.ToString();
}

}