Professional Documents
Culture Documents
20 May 2011
An introductory document to the IBM Cognos SDK that explains the basic requirements of an
SDK application using a stand-alone sample.
View more content in this series
Introduction
Purpose
This document is addressed to the software designers who are very familiar with the IBM Cognos
BI product and who would like to use the IBM Cognos BI Software Development Kit (SDK)
component. The IBM Cognos Software Development Kit contains many samples but they may
be intimidating for someone just starting out with the SDK because they are somewhat complex
and are not stand-alone as they make use of classes that are defined in other directories. This
document offers a simpler approach in that it contains only one source file with a self-contained
SDK application.
Applicability
This document has been written using IBM Cognos BI version 10.1 as the reference version.
However, the concepts presented also apply to versions 8.3 and greater of IBM Cognos 8 BI. The
code sample supplied with this document will need to be adapted to work with IBM Cognos 8 BI.
Trademarks
Page 1 of 14
developerWorks
ibm.com/developerWorks/
Most of the tasks that can be performed through the IBM Cognos BI user interface (UI)
The automation of repetitive non-UI tasks, such as scheduling large number of reports,
changing permissions for many reports, etc
Integrating IBM Cognos BI into other applications.
Examples of IBM Cognos Software Development Kit specific tasks include,
However, the IBM Cognos Software Development Kit cannot be used for tasks that are typically
associated with configuration and packaged user interfaces. For example, the SDK cannot modify
IBM Cognos BI user interface components such as,
Portal Pages
Logon Pages
Any user interface widgets
Studios in IBM Cognos Connection
Branding
Page 2 of 14
ibm.com/developerWorks/
developerWorks
Since the IBM Cognos Software Development Kit documentation is quite large, the new user is
encouraged to read about the essentials of the SDK in the developerWorks article IBM Cognos
Proven Practices: Approach to the IBM Cognos SDK, which can be found at the following URL,
http://www.ibm.com/developerworks/data/library/cognos/development/how_to/page129.html
Page 3 of 14
developerWorks
ibm.com/developerWorks/
An IBM Cognos Software Development Kit program can run on a computer which does not have
the IBM Cognos BI server installed. However the IBM Cognos Software Development Kit libraries
are required to be installed on this computer. The SDK libraries are located at:
IBM Cognos Proven Practices: Hands-on IBM Cognos Software
Development Kit Programming
Page 4 of 14
ibm.com/developerWorks/
developerWorks
Page 5 of 14
developerWorks
ibm.com/developerWorks/
Once connected to an IBM Cognos BI Dispatcher, the IBM Cognos Software Development
Kit application requests an IBM Cognos BI service. Unless the application is going to use the
Anonymous credentials, the application must request the Content Manager service because that is
the service that handles the logon/logoff processes.
Page 6 of 14
ibm.com/developerWorks/
developerWorks
The namespace ID, user name and password are supplied in an XML string known as a credential.
The credential takes the form of,
<credential>
<namespace>namespaceID</namespace>
<username>user<username>
<password>pwd</password>
</credential>
In the sample Java code, note the 3 lines following the call to the logon() method. These lines are
required to retrieve and store information related to the authenticated session into the cmService
variable. In IBM Cognos 8 this was handled automatically but in IBM Cognos 10, this must be done
programmatically as some of the session related information is dynamic and needs to be refreshed
before calling an IBM Cognos 10 service. For more information on this, see the Managing Service
Headers topic in the chapter titled Coding Practices and Troubleshooting in the IBM Cognos 10
SDK Developers guide.
Page 7 of 14
developerWorks
ibm.com/developerWorks/
java.net.URL;
javax.xml.namespace.QName;
org.apache.axis.client.Stub;
org.apache.axis.message.SOAPHeaderElement;
com.cognos.developer.schemas.bibus._3.BaseClass;
com.cognos.developer.schemas.bibus._3.BiBusHeader;
com.cognos.developer.schemas.bibus._3.ContentManagerService_PortType;
com.cognos.developer.schemas.bibus._3.ContentManagerService_ServiceLocator;
com.cognos.developer.schemas.bibus._3.PropEnum;
com.cognos.developer.schemas.bibus._3.QueryOptions;
com.cognos.developer.schemas.bibus._3.SearchPathMultipleObject;
com.cognos.developer.schemas.bibus._3.Sort;
com.cognos.developer.schemas.bibus._3.XmlEncodedXML;
Page 8 of 14
ibm.com/developerWorks/
developerWorks
Page 9 of 14
developerWorks
ibm.com/developerWorks/
}
System.out.println("PACKAGES:\n");
if (bc != null) {
for (int i = 0; i < bc.length; i++) {
System.out.println(bc[i].getDefaultName().getValue() + " - "
+ bc[i].getSearchPath().getValue());
}
}
}
// Step 4: Logoff from Cognos
private void logoffFromCognos() {
try {
cmService.logoff();
} catch (Exception ex) {
ex.printStackTrace();
}
}
Search Paths
A search path is used to specify the location of objects in the IBM Cognos BI Content Store
hierarchy. A search path can specify a path to a single Content Store object or it can make use of
expressions and wildcard characters to retrieve more that one Content Store object
The search path syntax is similar to a path in an operating system such as DOS or UNIX. More
specifically, it resembles XPath which is a query language for selecting nodes from an XML
document.
The syntax of a search path is described in detail in Appendix A of the IBM Cognos Software
Development Kit Developer Guide.
To get the search path for a report, click on the Set properties icon for the report in IBM Cognos
Connection. In the Set properties dialog, click on the View the search path, ID and URL link. A
dialog will pop up, which contains the Search Path as the first field.
Page 10 of 14
ibm.com/developerWorks/
developerWorks
When a path starts with two slashes (//), all objects in the content store that fulfill the specified
criteria are selected. For example,
//folder will return all Folder objects in the Content Store
//report will return all Report objects in the Content Store
When a path contains //, all descendants of the current object that fulfill the specified criteria are
selected. For example, to select and return all the reports in the 'Report Studio Report Samples
folder, use the search path :
IBM Cognos Proven Practices: Hands-on IBM Cognos Software
Development Kit Programming
Page 11 of 14
developerWorks
ibm.com/developerWorks/
/content/folder[@name='Samples']/folder[@name='Models']
/package[@name='GO Data Warehouse (analysis)']
/folder[@name='Report Studio Report Samples']//report
Page 12 of 14
ibm.com/developerWorks/
developerWorks
Downloads
Description
Name
Size
HandsOnSDK.zip
579KB
Page 13 of 14
developerWorks
ibm.com/developerWorks/
Page 14 of 14