How to create a logon token for the openDocument method and URL reporting using the Java SDK
[error reporting] [opendocument] [reporting service]
Symptom
How do I create a logon token for the openDocument method and URL reporting using the Java Software Development Kit (SDK)?
Cause
In BusinessObjects Enterprise XI Release 2, when using the openDocument method and URL reporting, Enterprise credentials can be passed using a logon token.?If a logon token is not created for the openDocument URL, a prompt will appear to log on to the Enterprise system.
Resolution
To create a logon token use the following sample code:
<%@page import="com.crystaldecisions.sdk.framework.*" %><%@page import="com.crystaldecisions.sdk.occa.infostore.*" %><%@page import="com.crystaldecisions.sdk.occa.security.ILogonTokenMgr" %><%//CMS logon informationString cms = "CMSServerName"; //Enterprise CMS ServerString webServer = "WebAppServer"; //Infoview Web Application ServerString userid = "Administrator";String pwd = "";String auth = "secEnterprise";String reportName = "World Sales Report"; //Hard coded for this example//Token specific informationString clientMachineName = "";int validMinutes = 30;int validNumOfLogons = 100;//Log onto the CMS and create a logon tokenISessionMgr entSessionMgr = CrystalEnterprise.getSessionMgr();IEnterpriseSession entSession = entSessionMgr.logon(userid, pwd, cms, "secEnterprise");ILogonTokenMgr logonTokenMgr = entSession.getLogonTokenMgr();String logonToken = logonTokenMgr.createLogonToken(clientMachineName, validMinutes,validNumOfLogons);//Get the report id to redirect toString infoStoreQuery = "select si_id from ci_infoobjects where si_kind=’CrystalReport’ andsi_instance=0 and si_name=’" + reportName + "’";IInfoStore infoStore = (IInfoStore) entSession.getService("", "InfoStore");IInfoObjects infoObjects = infoStore.query(infoStoreQuery);if ( infoObjects.isEmpty() ) {out.println("[" + reportName + "] not found.");} else {IInfoObject report = (IInfoObject) infoObjects.get(0);String rptID = "" + report.getID();//BOE XI R2 URLString urlRedirection = "http://" + webAppServer +":8080/businessobjects/enterprise115/desktoplaunch/opendoc/openDocument.jsp?iDocID="+ rptID + "&sType=rpt&sIDType=InfoObjectID&token=" + logonToken;response.sendRedirect(urlRedirection);
}%>
Keywords
Open Document Method, Java, logon token, XI, XI R2 , 951347