Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

OpenPages 7.2 and TDI (Problem / Conection Res-APIt)

72 views
Skip to first unread message

Oscar Riveros

unread,
Nov 17, 2016, 4:30:25 PM11/17/16
to


I'm working on an integration between OpenPages and TDI, but I have the following problem.
Context:

I have my assembly line with an example connector (IBM), but when I run I have the following output:

"
null
java.lang.NullPointerException
at java.io.StringReader.<init> (StringReader.java:44)
at com.ibm.di.entry.Entry.from.JSON(Entry.java:2570)
at sun.reflet.GeneratedMethodAccessor24.invoke(Unknow Source)

at
sun.reflet.DelegatingAccessorImpl.invoke(DelegatingMethodAccessorImpl.j ava:37)


at java.lang.reflet.Method.invoke(Method.java:611)
at com.ibm.jscript.types.JavaAccessObject.call(JavaAccessObject.java:321)
at com.ibm.jscripttypes.FBSObject.call(FBSOject.java:161)

"

I am connect with user/administrator and an environment local.



"I would greatly appreciate your help"

Eddie Hartman

unread,
Nov 18, 2016, 5:34:35 AM11/18/16
to
When you say 'example connector (IBM)' do you mean an OpenPages Connector, Oscar? And if not, what kind of Connector are you using?

Oscar Riveros

unread,
Nov 18, 2016, 8:34:15 AM11/18/16
to
yes,

// Sample connector
// Place initialization code before function declarations
//
var host
var isDebug
var port
var user
var password
var type
var query
//user functions
var http = system.getConnector("ibmdi.HTTPClient")
var rows
var rowCount

function logmsg(msg)
{
java.lang.System.out.println(msg)
}

function initialize()
{
host = connector.getParam("host");
if(host == null && isDebug) host = "ADMINIB-P3BA6L6";
logmsg("Host: "+host);

port = connector.getParam("port");
if(port == null && isDebug) port = "10108";
logmsg("Port: "+port);

user = connector.getParam("user");
if(user == null && isDebug) user = "test";
logmsg("User: "+user);

password = connector.getParam("password");
if(password == null && isDebug) password = "test";
logmsg("Password: "+password);

type = connector.getParam("type");
if(type == null && isDebug) type = "LossEvent";
logmsg("Object Type: "+type);

query = connector.getParam("query");
if(query == null && isDebug) query = "SELECT * FROM [LossEvent]";
logmsg("Query String: "+query);
}

function selectEntries()
{
var baseUrl = "http://"+host+":"+port

var queryBase = "/grc/api/query?q="

var url = baseUrl + queryBase + query

http.setParam("username",user)
http.setParam("password",password)

http.setParam("url",url)
//get method by default
http.initialize(null)

var retEntry = http.queryReply(null)
var body = retEntry.getString("http.bodyAsString")

//result is JSON entries
var atom = retEntry.fromJSON(body)

rows = atom.rows.rows
rowCount = 0;

}

function getNextEntry ()
{

if (rowCount >= rows.getLength()){

result.setStatus (0);
return;
}

var row = rows[rowCount]
var fields = row.fields.field.field
for( att in fields){
var fieldName = att.getElementsByTagName("name")[0]
var dataType = att.getElementsByTagName("dataType")[0]
logmsg("Field: "+fieldName+" "+dataType);
var attValue = null
var valueNode = att.getElementsByTagName("value")
if(valueNode.getLength()>0){
attValue = valueNode[0]
}else if(dataType == "CURRENCY_TYPE"){
attValue = att.getElementsByTagName("baseAmount")[0]
}
else if(dataType == "ENUM_TYPE"){
enumNode = att.getElementsByTagName("enumValue")
if(enumNode.getLength()>0){
enumValueNameNode = enumNode[0].getElementsByTagName("name")
if(enumValueNameNode.getLength()>0){
attValue = enumValueNameNode[0]
}
}
}
entry[fieldName] = attValue
}
rowCount++
}

function putEntry ()
{
}

function modEntry ()
{
}

function deleteEntry ()
{
}

function findEntry ()
{
}

function querySchema ()
{
var e = system.newEntry()
e.addAttributeValue("name","counter");
e.addAttributeValue("syntax","Number");
list.add(e);
result.setStatus (1);
}

Brian Laskey

unread,
Nov 18, 2016, 11:53:07 AM11/18/16
to
Hi Oscar, can you also share a little more of your use-case? it seems like you are trying to extract Loss Events from the OP server, right?

Are you using the OP connector provided with the ITG assemblyline in OP 7.2? Which by default is under <OP_Home>/OpenPages/integrations/ITG (on UNIX operating systems)

I have less experience with the TDI error you see, but it might be you are getting no results from your query? Can you try your query directly via the OpenPages REST API?
query = "SELECT * FROM [LossEvent]";

For some info on the REST API itself, maybe you can start here if you aren't familiar:
https://www.ibm.com/developerworks/community/blogs/d89a3ddf-2acf-4cc8-b11b-14f33b5c653e/?lang=en
and
http://www-01.ibm.com/support/docview.wss?uid=swg27046995 (see OpenPages GRC Rest API Reference Guide [pdf] )

Oscar Riveros

unread,
Nov 18, 2016, 2:56:45 PM11/18/16
to
Yes, Brian Laskey. thanks for your help
0 new messages