Data Management Group
Company Professional Services Solutions Technology Expertise Training & Education Resources
Resources










Contact Us

BI Advantage Newsletter

 

 

QUERYING THE COGNOS REPORTNET CONTENT STORE USING THE SDK VIA ASP.NET

The information in the article refers to
Cognos ReportNet

Applies to
ReportNet SDK Reported version only
Crystal Enterprise client sample tools
Desktop Launchpad utilities


Synopsis
Have you ever wondered, "How do I query the Cognos ReportNet content store using the SDK using Visual Studio.Net without using the SOAP toolkit?"

Solution
Short solution:
Add a web reference to Visual Studio pointing to http:// /crn/cgi-bin/cognos.cgi?wsdl

Long solution:
In Visual Studio.Net, right click on Web References in the Solution Explorer, then select Add Web Reference. Type in the URL to your WSDL. Give it a name such as "CognosReportNet." Then in your code behind page, start it off with "Imports CognosReportNet." Now all the Cognos ReportNet methods, objects and properties are available to you. Test it out by logging on and querying the content store to get only the top level folders like this:

'Initiate the ReportNet service
Dim oCrn As New CognosReportNetService

'Log on to ReportNet using credentials
Dim usr As String = <username>
Dim pwd As String = <password>
Dim ns As String = <Namespace>
Dim xmlLogon As String = XMLEncode ("<credential><namespace>" & ns & </namespace><username>" & usr & ("</username><password>" & pwd & </password><credential>"

oCrn.logon(xmlLogon, Nothing)

'Get only the top level folders
Dim strSearch As String
strSearch = "/content/folder"

'Set the properties we wish to query for
Dim properties(2) = propEnum
properties(0) = propEnum.defaultName
properties(1) = propEnum.searchPath

'Set the sorting options
Dim sortBy() As sort
sortBy(1) = New sort
sortBy(1).order = orderEnum.ascending
sortBy(1).propName = propEnum.defaultName

'Perform the Query
Dim results As baseClass()
results = oCrn.query(strSearch, properties, sortBy, New queryOptions)

'Loop through the results
Dim rLen As Integer = UBound(results)
Dim Jodi As Integer
For i = 0 To rLen
   Dim curRes = results(i)
   Dim srchPath As String = CurRes.srchPath.value
   Dim defName As String = CurRes.defaultName.value

   'Display a list of the names - search paths
   Response.Write (defName & " - " & srchPath & "
" & vbCrLf)
Next
Contgrats! Now you can query the content store of Cognos ReportNet using the SDK.


Questions
Have a question for our trainers?
Click here to send your questions!

 

Professional Services

To find out how we can help you solve your information challenges, visit our professional services pages:

Blueprint Analysis
Business Intelligence Implementation
Performance Management
Data Management
Business Intelligence Integration
Training and Education

Career Post Email


COMPANY | PROFESSIONAL SERVICES | SOLUTIONS | TECHNOLOGY EXPERTISE | TRAINING & EDUCATION | RESOURCES