Buy the Cognos SDK Guide by BI Centre Now

The Cognos SDK Guide by BI Centre provides you with the complete source code for a C# web solution, C8.1 report based on the GOSR package, and a Word document that will serve as your core reference to understanding the Cognos 8 SDK. It will cover C8 SDK topics such as: authentication; querying the Cognos content store; rendering a C8 report in ASP.NET; exception handling; and much more.

Buy the Cognos 8 Modification Check Now

Friday, January 11, 2008

Exception Handler Class -- Exhandler.cs

ExHandler.cs is used to handle SOAP Exceptions that may be encountered when making Cognos service requests.  The ExHandler.cs class allows you to display a meaningful error message to the end user.  It captures the severity, error code, message and details of the exception that has been encountered.  These values are appended and returned as a string.


This is example code to capture the Exception’s severity.


/// Return the exception severity. ///

public string Severity{


            XmlNode severityNode = exSoap.Detail.SelectSingleNode( "//severity");

                  if (severityNode != null)


                        return severityNode.InnerText;



return "";







Your web solution should have all of it’s TRY-CATCH statements updated in order to reference the functionality ExHandler.cs class file.  You would simply have to instantiate the object in your updated Catch statements.


ExHandler exCognos = new ExHandler(exSoap);



Here is a more detailed example showing the updated Catch statement and appending a string object with the full exception message.




                        _cmService = new contentManagerService1();

                        _rptService = new reportService1();


                        _dispC8 = ConfigurationSettings.AppSettings["CognosDispatcher"];

                        _NmSpace = ConfigurationSettings.AppSettings["CNmspace"];

                        _Pwd = ConfigurationSettings.AppSettings["CTSpwd"];

                        _Uid = ConfigurationSettings.AppSettings["CTSuid"];

                        _CSTypePkg = ConfigurationSettings.AppSettings["CSTypePkg"];

                        _CSTypeRpt = ConfigurationSettings.AppSettings["CSTypeRpt"];


                        _cmService.Url = _dispC8;

                        _rptService.Url = _dispC8;


                        _cogSDK = new CognosSDK();


                        _cogSDK.CognosLogon(_cmService,_NmSpace,_Uid, _Pwd);

                        _rptService.biBusHeaderValue = _cmService.biBusHeaderValue;



                  catch (SoapException exSoap)


                        ExHandler exCognos = new ExHandler(exSoap);

                        _ErrMsg = exCognos.Details + " :-: " + exCognos.Message +  " :-: " + exCognos.Severity +  " :-: " + exCognos.ErrorCode;


                  catch (Exception ex)


                        _ErrMsg = ex.Message.ToString();






Cognos 8 SDK google search


New C8 SDK Utility --- Cognos 8 Modification Check

The BI Centre C8 Modification Check provides a Cognos SDK developer with a workable C# solution that will allow you to:

· Search the Content Store for items that have been modified after a selected date value

For example, if you were looking for all reports that were modified on June 3rd, 2008 then you would select the date June 2nd, 2008. The code will search for all items that have been modified after the selected date value from the date control.

The results of the search are then rendered to a text box control.