Sdk Samples With Ides

download Sdk Samples With Ides

of 30

Transcript of Sdk Samples With Ides

  • 8/10/2019 Sdk Samples With Ides

    1/30

    Proven Practice

    Setting Up An IDE For Use WithThe IBM C8 SDK Samples

    Product(s): IBM Cognos 8 BI

    Area of Interest: Software Development Kit

  • 8/10/2019 Sdk Samples With Ides

    2/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    2

    Cognos Proprietary Information

    Copyright

    Copyright 2008 Cognos ULC (formerly Cognos Incorporated). Cognos ULCis an IBM Company. While every attempt has been made to ensure that theinformation in this document is accurate and complete, some typographicalerrors or technical inaccuracies may exist. Cognos does not accept

    responsibility for any kind of loss resulting from the use of informationcontained in this document. This document shows the publication date. Theinformation contained in this document is subject to change without notice.Any improvements or changes to the information contained in this documentwill be documented in subsequent editions. This document containsproprietary information of Cognos. All rights are reserved. No part of thisdocument may be copied, photocopied, reproduced, stored in a retrievalsystem, transmitted in any form or by any means, or translated into anotherlanguage without the prior written consent of Cognos. Cognos and theCognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated)in the United States and/or other countries. IBM and the IBM logo aretrademarks of International Business Machines Corporation in the UnitedStates, or other countries, or both. All other names are trademarks or

    registered trademarks of their respective companies. Information aboutCognos products can be found at www.cognos.com

    This document is maintained by the Best Practices, Product and Technologyteam. You can send comments, suggestions, and additions [email protected].

  • 8/10/2019 Sdk Samples With Ides

    3/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    3

    Cognos Proprietary Information

    Contents

    1INTRODUCTION............................................................................................ 4

    1.1 ........................................................................................................... PURPOSE...4

    1.2.....................................................................................................

    APPLICABILITY...41.3 ..................................................................................EXCLUSIONS AND EXCEPTIONS...4

    2STARTING OUT WITH THE COGNOS 8 SDK .................................................. 4

    3SDK SAMPLES USING THE ECLIPSE IDE....................................................... 5

    4SDK SAMPLES USING THE NETBEANS IDE ................................................. 15

    5SDK SAMPLES IN VISUAL STUDIO.............................................................. 25

    6RESOURCES................................................................................................. 30

    6.1 .....................................................................................JAVA TOOLSAND TRAINING. 30

    6.2 .............................................................................................................XPATH. 30

    6.3 ........................................................................................................JAVASCRIPT. 30

    6.4...............................................................................................................

    SOAP. 30

    6.5........................................................................

    GENERAL WEB SERVICES REFERENCES. 30

  • 8/10/2019 Sdk Samples With Ides

    4/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    4

    Cognos Proprietary Information

    1 Introduction

    1.1 Purpose

    This document is intended to help the reader become more comfortable with

    the IBM Cognos 8 Software Development Kit (SDK) using the SDK samples inconjunction with some of the Integrated Development Environments (IDE) thatare available today. The goal of this document is not to make the reader aprogrammer but to make the SDK more accessible to those who want to worktheir way through the samples, modify and run an existing program or as a selftraining guide.

    Please note that the IDEs covered in this document do not construe anendorsement over other IDEs that are available. If the reader prefers to useanother IDE, the reader is encouraged to submit a document to the CognosProven Practices group that shows how to use that IDE to set up, build and runthe IBM Cognos 8 SDK samples.

    1.2 Applicability

    To those new to working with the IBM Cognos 8 SDK on any of the supportedplatforms.

    1.3 Exclusions and Exceptions

    No known exclusions or exceptions at this time.

    2 Starting Out With The Cognos 8 SDK

    There is extensive documentation available for the IBM Cognos 8 SDK. TheIBM Cognos 8 SDK Getting Started guide contains a comprehensive overview

    of the IBM Cognos 8 SDK and it is recommended that the reader be familiarwith the contents of the Getting Started guide be read before continuing withthis document. The IBM Cognos 8 SDK Developer Guide is the comprehensivereference for writing SDK applications. This document describes all the classesand relationships that are exposed via the SDK.

    The amount of documentation can be overwhelming to those new to the SDKand it may be helpful to find a balance between reading documentation andexploring sample code. There are several sample programs installed with theIBM Cognos 8 SDK that can be used to learn and experiment with the SDK.The samples can be found in separate directories for each languageunderneath the directory /sdk. For example, the Java samplesare /sdk/java.

    A Microsoft development environment is required to use the C# or Visual Basicsamples. The Java sample code can be built and run using slightly modifiedversions of the scripts that are included with the samples. To use these scripts,it may be necessary to edit the build and run scripts to point to your Cognos 8installation and JDK location. The scripts are run from a command window.

  • 8/10/2019 Sdk Samples With Ides

    5/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    5

    Cognos Proprietary Information

    It is strongly recommended that an IDE be used for SDK development. Theremainder of this document will focus on setting up the samples using twopopular Java IDEs (Eclipse and NetBeans) and the Microsoft Visual Studio.Once the samples set up inside the IDE, the steps required to run one of thesample programs will be shown.

    3 SDK Samples using the Eclipse IDE

    Launch Eclipse.

    The initial dialog will ask for the location where Eclipse can store informationassociated with projects. This location is known as a workspace. Typically aprojects source code will a part of the workspace but it is important to notethat if a project is created using existing source files, these source files will notreside in the workspace.

    Check the highlighted box if Eclipse should always use the same workspace on

    startup and not present this dialog.

  • 8/10/2019 Sdk Samples With Ides

    6/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    6

    Cognos Proprietary Information

    If the Welcome screen appears, close the Welcome screen.

  • 8/10/2019 Sdk Samples With Ides

    7/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    7

    Cognos Proprietary Information

    Eclipse comes with named sets of screens bundled together for particularpurposes. These sets are calledperspectives. The Java perspective, shownbelow, is the default. If, for some reason, the Java perspective is notdisplayed, redisplay it by navigating to Window -> Open Perspective -> JavaPerspective.

  • 8/10/2019 Sdk Samples With Ides

    8/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    8

    Cognos Proprietary Information

    Create a project in Eclipse by navigating to File -> New -> Project -> JavaProject. Choose a Java Project, and press the Next button.

  • 8/10/2019 Sdk Samples With Ides

    9/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    9

    Cognos Proprietary Information

    Name the project. In this example the project is named c8samples.

    Select the Create project from existing source option and navigate to thedirectory in which you installed the IBM Cognos 8 SDK.

    Press the Next button.

  • 8/10/2019 Sdk Samples With Ides

    10/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    10

    Cognos Proprietary Information

    Eclipse will automatically build the project once it is defined. Note that there isan option to specify the default output folder.

  • 8/10/2019 Sdk Samples With Ides

    11/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    11

    Cognos Proprietary Information

    Choose the Libraries tab. Notice that the IBM Cognos specific jar files havebeen included in the project. Also note the buttons on the right hand sidewhich allows new libraries and jar files to be added to a project as required.

    Press the Finish button.

  • 8/10/2019 Sdk Samples With Ides

    12/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    12

    Cognos Proprietary Information

    Eclipse has now built the project. From the Package Explorer, expand thec8Samplesproject

  • 8/10/2019 Sdk Samples With Ides

    13/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    13

    Cognos Proprietary Information

    As can be seen, there are a several individual programs contained within thesingle project. In addition to being able to run theses programs from theEclipse IDE, these programs can also be run from from the command line usingrun.bat in Windows or run.sh in Unix or Linux.

    This example will run the runreportsample program from within the EclipseIDE.

    Highlight runreportin the Package Explorer, right click and select Run As ->Run

  • 8/10/2019 Sdk Samples With Ides

    14/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    14

    Cognos Proprietary Information

    The Run dialog appears. To run the program, set the Main class field toreportrunnerand click the Run button.

  • 8/10/2019 Sdk Samples With Ides

    15/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    15

    Cognos Proprietary Information

    The results of the program appear in the Console window on the lower partof the page. The output shows the program connecting to a Cognos 8dispatcher, running the report, and reporting the results.

    4 SDK Samples using the NetBeans IDE

    Launch NetBeans.

    Create a new project by selecting File -> New Project. The New Project wizardwill appear.

    Choose the project type Java Application with Existing Sources and click theNext button.

  • 8/10/2019 Sdk Samples With Ides

    16/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    16

    Cognos Proprietary Information

  • 8/10/2019 Sdk Samples With Ides

    17/30

  • 8/10/2019 Sdk Samples With Ides

    18/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    18

    Cognos Proprietary Information

    In the Existing Sources dialog, press Add Folder. Navigate to the folder wherethe Java SDK samples were installed and select it.

    Press the Finish button.

  • 8/10/2019 Sdk Samples With Ides

    19/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    19

    Cognos Proprietary Information

    On the left hand side in the Projects pane, expand the project that was justcreated. Right click on the project and select Properties item to open theProject Properties window.

  • 8/10/2019 Sdk Samples With Ides

    20/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    20

    Cognos Proprietary Information

    Select the librariescategory from the Project Properties window. Press the AddJar/Folder button on the right hand side, navigate to the directory /binand select all of the .jar files that begin with CAM. Press Open.

  • 8/10/2019 Sdk Samples With Ides

    21/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    21

    Cognos Proprietary Information

    Select the librariescategory from the Project Properties window. Press the AddJar/Folder button on the right hand side, navigate to /sdk/java/liband select all of the .jar files you find there. Press Open.

  • 8/10/2019 Sdk Samples With Ides

    22/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    22

    Cognos Proprietary Information

    Press the OK button.

  • 8/10/2019 Sdk Samples With Ides

    23/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    23

    Cognos Proprietary Information

    To run the runreportprogram, select runreportin the Projects pane. From themenu bar, choose Run > Run Main Project

  • 8/10/2019 Sdk Samples With Ides

    24/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    24

    Cognos Proprietary Information

    Look for the programs output in the Output pane.

  • 8/10/2019 Sdk Samples With Ides

    25/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    25

    Cognos Proprietary Information

    5 SDK Samples in Visual Studio

    NOTE : If using Visual Studio 2003 and the .NET Framework 1.1, ensure thatthe hotfix described in the Cognos Knowledge Base document 1016458 hasbeen applied.

    Launch Visual Studio.

    Select File- > Open -> Project and browse to the /sdk/csharpdirectory to select the solutionAllSamples.sln.

  • 8/10/2019 Sdk Samples With Ides

    26/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    26

    Cognos Proprietary Information

    From the Build Menu, select Build Solution.

  • 8/10/2019 Sdk Samples With Ides

    27/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    27

    Cognos Proprietary Information

    In the Solution Explorer pane, select the reportrunnerprogram. Expand the

    folder to see the csharp_reportrunner_Explain.htmland click on it to view thecontents. This file contains instructions on how to build and run this sampleprogram.

  • 8/10/2019 Sdk Samples With Ides

    28/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    28

    Cognos Proprietary Information

    To execute the reportrunner program, open a command window, navigateunder the csharpdirectory of the sample structure, type reportrunner.exeand press enter.

  • 8/10/2019 Sdk Samples With Ides

    29/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    29

    Cognos Proprietary Information

    Here the executing program reports the connect to the dispatcher, the reportbeing executed and the end result.

  • 8/10/2019 Sdk Samples With Ides

    30/30

    Setting Up An IDE For Use With TheIBM C8 SDK Samples

    30

    6 Resources

    The reader may find that the following links contain information that is usefulwhen developing applications using the IBM Cognos 8 SDK.

    6.1 Java Tools And Training

    www.eclipse.org www.netbeans.org http://java.sun.com http://java.sun.com/developer/onlineTraining/

    6.2 XPATH

    http://www.w3schools.com/xpath/default.asp http://www.zvon.org/xxl/XPathTutorial/General/examples.html

    6.3 JavaScript

    http://www.w3schools.com/js/default.asp http://www.ecma-international.org/publications/standards/Ecma-

    262.htm

    6.4 SOAP

    http://www.w3schools.com/soap/default.asp http://www.w3.org/TR/soap/ Microsoft SOAP Toolkit 3.0

    6.5 General Web Services References

    http://www.looselycoupled.com/

    http://msdn.microsoft.com/webservices/ http://java.sun.com/webservices/