Wednesday, July 7, 2010

Integration of Cognos with .Net Application

Business Scenario :
ABC Client wanted to implement some Reports in Cognos.The main problem was to integrate Cognos reporting features within their existing .Net enviroment as they lack in Cognos Expertise. Their existing reporting was in Crystal Reports XI which comes bundled with .Net but lacks BI capabilities. Customer wanted to implement BI capabilities within .Net. And in such a way that the authentication mechanism used for portal and Cognos should be same and need to implement Single Sign On.So they approached us for a POC for implementing Cognos within .Net
Solution Provided :
There are 2 ways to Cognos reports/portal from .Net application
Option 1 . Embed Cognos 8 generated URL within .NET web application page and pass parameters and runOption type through the URL method.
Option 2 . Enabling single sign-on to CRN or Cognos 8 secured against Application Server Authentication mechanism.
In the current POC we have described Option 1. For Option 2 there are various documents available with Cognos Site which can be implemented.
But in the current scenario there is no such Application Server so obvious option was 1.
Steps for Option 1
1 . Cognos Configuration to access Active Directory.
2 . Creation of sample report in Report Studio
3 . Building of URL to access sample reports
4 . Integration of Cognos URL within .NET application Note : Active Directory authentication mechanism is used for both the application (Cognos 8 and .Net )

1. Cognos Configuration to access Active Directory
Open Cognos Configuration and create authentication method to access Active Directory
1. Create a new Namespace for Authetication ‘AD’ of type Active Directory in Cognos Configuration.
2. Host and port : yourcompany.com:389
3. Advanced Properties –
Name –singleSignOnOption
Value – IdentityMapping
4. Allow anonymous access - False

2 . Creation of sample report in Report Studio
A sample report is created in Cognos Report Studio.
3. Building of URL to access sample reports
From the Settings of report folder get the Search Path or URL
Viewing Portal Pages
http://server-name/cognos8/cgibin/cognos.cgi?b_action=xts.run&m=portal/cc.xts&m_page=iFEAD7E0238FD4FB0B7CC9144E91
C79BC
Folder Browsing
http://server-name/Cognos8/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/cc.xts&m_path=/content/package[@name='GO Sales
and Retailers']/folder[@name='Report Studio Report Samples']

Searching
http://server-name/cognos8/cgibin/
cognos.cgi?stext=banded+report&b_action=xts.run&m=portal/cc.xts&m_path=/content&search=

See pic below to get the Report URL

4. Integration of Cognos URL within .NET application

Creation of Login Page in .Net and using Active Directory for Authentication Mechanism.


Similarly as in ASP ,to get Cognos report folder the below mentioned URL needs to be embed within .NET web page. The URL will accept the UserID/Password(marked in red) valid within .NET session.
http://Server-name/cognos8/cgi-bin/cognos.cgi?b_action=cognosViewer&ui.action=run&&CAMUsername=" & strUserName & "&CAMPassword=" & strPassword & "&h_CAM_action=logonAs&CAMNamespace=AD&&&ui.object=%2fcontent%2fpackage%5b%40name%3d%27poc%27%5d%2freport%5b%40name%3d%27rpt_Funding%20Summary%27%5d&ui.name=rpt_Funding%20Summary&run.outputFormat=&run.prompt=true
The parameter strUserName and strPassword are declared in .NET web page and captures the value that were passed during Login screen of .Net web page.



Summary
Accessibility and authentication from .NET to Cognos reports has been done by checking Windows Active directory in Cognizant domain.
By opening the .NET web page it will ask for Cognizant user ID/Password and will redirect you to Cognos sample report folder list, where you can select and execute the reports.
The objective is to simply use the session variable to authenticate through Active Directory and pass it into Cognos URL.