cognos java api_Cognos API Connection

Cognos Connection, 通过 Cogons API 访问Cogons 已经安装好的平台,获取已经创建好的Report,修改此report,或者运行此report获取结果等。。。

分析Connection. 简单代码如下:

package test;

import java.net.URL;

import javax.xml.namespace.QName;

import org.apache.axis.client.Stub;

import org.apache.axis.message.SOAPHeaderElement;

import com.cognos.developer.schemas.bibus._3.BaseClass;

import com.cognos.developer.schemas.bibus._3.BiBusHeader;

import com.cognos.developer.schemas.bibus._3.ContentManagerService_PortType;

import com.cognos.developer.schemas.bibus._3.ContentManagerService_ServiceLocator;

import com.cognos.developer.schemas.bibus._3.PropEnum;

import com.cognos.developer.schemas.bibus._3.QueryOptions;

import com.cognos.developer.schemas.bibus._3.Report;

import com.cognos.developer.schemas.bibus._3.SearchPathMultipleObject;

import com.cognos.developer.schemas.bibus._3.Sort;

import com.cognos.developer.schemas.bibus._3.XmlEncodedXML;

public class CognosConnectionUtil

{

private ContentManagerService_PortType cmService = null;

public static void main(String[] a) throws Exception

{

//1. instantiate the class

CognosConnectionUtil mainClass = new CognosConnectionUtil();

// Step 2: Logon to Cognos

mainClass.logonToCognos();

// Step 3: Execute tasks

mainClass.executeTasks();

// Step 4: Logoff from Cognos

mainClass.logoffFromCognos();

}

// Step 2: Logon to Cognos

private void logonToCognos() throws Exception

{

String dispatcherURL = "http://xxxxxxxxxxxxxxxxxx/p2pd/servlet/dispatch";

String nameSpaceID = "XXXXX";

String userName = "XXXX";

String password = "XXXXX";

ContentManagerService_ServiceLocator cmServiceLocator = new ContentManagerService_ServiceLocator();

URL url = new URL(dispatcherURL);

cmService = cmServiceLocator.getcontentManagerService(url);

StringBuffer credentialXML = new StringBuffer();

credentialXML.append("");

credentialXML.append("").append(nameSpaceID).append("");

credentialXML.append("").append(userName).append("");

credentialXML.append("").append(password).append("");

credentialXML.append("");

String encodedCredentials = credentialXML.toString();

XmlEncodedXML xmlCredentials = new XmlEncodedXML();

xmlCredentials.set_value(encodedCredentials);

cmService.logon(xmlCredentials, null);

SOAPHeaderElement temp = ((Stub) cmService).getResponseHeader("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader");

System.out.println(temp.toString());

BiBusHeader CMbibus = (BiBusHeader) temp.getValueAsType(new QName("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader"));

((Stub) cmService).setHeader("http://developer.cognos.com/schemas/bibus/3/", "biBusHeader", CMbibus);

}

// Step 3: Execute tasks

private String executeTasks()

{

PropEnum props[] = Util.getAllPropEnum();

BaseClass bc[] = null;

String searchPath = "/content/folder[@name='Test']/report[@name='test']";

try

{

SearchPathMultipleObject spMulti = new SearchPathMultipleObject(searchPath);

bc = cmService.query(spMulti, props, new Sort[] {}, new QueryOptions());

}

catch (Exception e)

{

e.printStackTrace();

}

System.out.println("PACKAGES:\n");

if (bc != null)

{

for (int i = 0; i < bc.length; i++)

{

Report report = (Report) bc[i];

System.out.println(report.getDefaultName());

}

}

return searchPath;

}

// Step 4: Logoff from Cognos

private void logoffFromCognos()

{

try

{

cmService.logoff();

}

catch (Exception ex)

{

ex.printStackTrace();

}

}

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/411564.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

流程管理软件如何适应变化

最近接触了一些关于SOA的相关理论&#xff0c;很是遗憾&#xff0c;没看出什么名堂来。最近为什么网络上比较流行SOA呢?个人认为这东西太悬乎了&#xff0c;凡是有什么好的软件思想或是方法都称之SOA,难怪架构师和软件企业那么热忠的去追捧它,似乎SOA万能&#xff0c;好多软件…

import json java_JAVA的JSON数据包装-博客园老牛大讲

标签&#xff1a;一、什么是json呢&#xff1f;{"id":"1","username":"老牛大讲堂","password":"123"}这就是json数据。用来和页面(HTMl)进行通信的。二、通信为什么用json呢&#xff1f;没有为啥&#xff0c;因为…

[html]请描述HTML元素的显示优先级

[html]请描述HTML元素的显示优先级 在html中&#xff0c;帧元素&#xff08;frameset&#xff09;的优先级最高&#xff0c;表单元素比非表单元素的优先级要高。表单元素:文本输入框&#xff0c;密码输入框&#xff0c;单选框&#xff0c;复选框&#xff0c;文本输入域&#x…

Scrapy+ Selenium处理广告

https://blog.csdn.net/zwq912318834/article/details/78612762转载于:https://www.cnblogs.com/guozepingboke/articles/10815334.html

.Net+SQL Server企业应用性能优化笔记3——SQL查询语句

在上一篇文章中我们使用了几种方法来确定瓶颈&#xff0c;找到瓶颈&#xff0c;下面再回顾一下&#xff1a; LoadRunner压力测试Windows计数器&#xff0c;这种方法主要是找出大概的性能问题是在哪台服务器&#xff0c;主要是哪个资源紧张。 ANTS ProfilerSQL Server Profiler&…

类的创建与继承

一、类的创建 在面向对象编程中&#xff0c;类(class)是对象(object)的模板&#xff0c;定义了同一组对象(又称实例)共有的属性和方法。JavaScript语言里是没有类的概念的&#xff0c;但是我们通过以下方法也可以模拟出类。 1. 利用this关键字&#xff1a; function User(){thi…

java 电梯算法_编程之美之小飞的电梯调度算法(多种解法)---Java语言

1.题目情景我们假设都是从一楼上电梯的&#xff0c;而至于讯电梯停在其中的某一层。即所有的乘客都从一楼上电梯&#xff0c;到达某层之后&#xff0c;电梯停下来&#xff0c;所有乘客再从这里爬楼梯到自己的目的层。在一楼的时候&#xff0c;每个乘客选择自己的目的层&#xf…

[html] 关于<form>标签的enctype属性你有哪些了解?

[html] 关于标签的enctype属性你有哪些了解&#xff1f; form 标签的 enctype 属性指定将数据回发到服务器时浏览器如果对表单数据进行编码&#xff0c;其有三种编码形式&#xff1a;application/x-www-form-urlencoded(也是默认格式)application/x-www-form-urlencoded编码类…

砂.随笔.二十.微笑

左脑和右脑在争吵 左手和右手在撕扯 左脚和右脚走向两端 撕扯着神经 我想要疯狂地尖叫 但熟悉的人和面孔在对着我微笑 那么弯起嘴角吧 那么眯起眼角吧 那么就这样吧 就只能是这样了 我的尖叫和痛哭掩盖在微笑的面具下慢慢窒息 这样或许是最好的 谁都不知道你们曾经到来过 那么就…

[html] 说说你对属性data-的理解

[html] 说说你对属性data-的理解 data- 属性是H5新增的自定义属性&#xff0c;也可以用来存储值。我个人用的不多&#xff0c;这个data- 属性倒是和vue中的v-bind 功能相似&#xff0c; 自定义属性&#xff0c;绑定数据。也和上面说的一样可以通过js进行获取使用个人简介 我是…

React中添加注释

React中的注释&#xff0c;其实确切来讲是jsx中的注释&#xff1a; {/*单行注释*/}{/*多行注释 */} 转载于:https://www.cnblogs.com/wsg25/p/10818246.html

好文章系列(都是网上非常好的文章)

CSDN第一期总结之一&#xff1a;Form问题 CSDN第一期总结之二&#xff1a;ADO.NET DataGrid的问题 CSDN第一期总结之三&#xff1a;Thread的问题 CSDN第一期总结之四&#xff1a;Stream的问题 转载于:https://www.cnblogs.com/woowater/archive/2008/12/03/1346975.html

[html] 请说说<script>、<script async>和<script defer>的区别

[html] 请说说<script> : 加载的时候是同步的会阻塞后面代码的执行&#xff0c;加载立即执行。<script async>: 异步加载&#xff0c;加载和执行是并行的。<script defer>: 异步加载&#xff0c;需等到所有文档加载完才执行。个人简介 我是歌谣&#xff0c;…

electron-关闭之前,弹出提示窗

tips:写的时候&#xff0c;如果不在弹窗之前调用一次阻止默认事件&#xff0c;窗口就会直接关闭&#xff1b; 对话框dialog 在主进程中调用&#xff0c;const {dialog} require(electron); 传送门&#xff1a;electron dialog对话框 转载于:https://www.cnblogs.com/huangmin1…

java 定义对象数组_javascript如何定义对象数组

问题如下&#xff0c;已经完成单个对象的简单应用&#xff0c;希望定义一个数组&#xff0c;能包含多个student。var student new Object();student.name "Lanny";student.age "25";student.location "China";var json JSON.stringify(stud…

英文学习网站

(转)笑看风云淡Official Silverlight WebSiteNikhil Kothari(微软Principal Architect)s blogBrad Adams(首席产品部门经理)s BlogJesse Liberty(微软高级程序经理)s BlogTim Heuer(微软高级程序经理)s Blog(很nice的一个人&#xff0c;我内部发信问过问题^_^)Adam Kinney(微软…

进程(二)

import osimport timefrom multiprocessing import Processdef func(args,args2): print(args,args2) time.sleep(3) print(子进程 :, os.getpid()) print(子进程的父进程 :, os.getppid()) print(12345)if __name__ __main__: p Process(targetfunc,args(…

[html] 你了解什么是无障碍web(WAI)吗?在开发过程中要怎么做呢

[html] 你了解什么是无障碍web&#xff08;WAI&#xff09;吗&#xff1f;在开发过程中要怎么做呢 navigation control (tabindex)focus control (js)semantic html (h1, form, section...aria roles, labels...alt...)color theme (color-blind friendly)keyboard action supp…

硬盘 光驱 跳线问题

1.硬盘出厂时一般默认就是“主盘”&#xff0c;而光驱出厂时的跳线一般默认是“从盘”。 2.数据线上的三个端口是有定义的&#xff0c;不能随便连接设备。中间的那个端口是“Slave”&#xff0c;是用来连接从盘的&#xff1b;离“Slave”端口最近的那个是“Master”&#xff0c…

区域负责人常用的ChatGPT通用提示词模板

区域市场分析&#xff1a;如何分析区域市场的特点、竞争态势和客户需求&#xff1f; 区域销售策略制定&#xff1a;如何制定针对区域市场的销售策略&#xff0c;包括产品定位、价格策略、渠道策略等&#xff1f; 区域销售目标设定&#xff1a;如何设定明确的区域销售目标&…