How to get LogonToken Without use SessionMgr.logon Method?

Hi,

I need to get only LogonToken (Java SDK). I created a aspx application that need logonToken to connect in BusinessObjects XI 3.1. and run webi reports through logonwithtoken().

I need only user LogonToken.

Anyone know where BO XI 3.1 store it. If are session variables, constants?, what package or JAR include into app.

Best Regards,

IEnterpriseSession enterpriseSession;
try
{
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = sessionMgr.logon(userID, password, CMS, auth);
logonToken = enterpriseSession.getLogonTokenMgr().getDefaultToken();


russell :panama: (BOB member since 2006-08-12)

The logon token cannot be retrieved without first logging on.
You could generate a logon token and save that somewhere but it will only be good for a short time and then you will need to generate it again.


darcstorm :philippines: (BOB member since 2008-07-22)

OK darcstorm,

I have created hyperlink into Infoview --> Public Folders–> APP Folder to ASPX page. My idea is one time log on in Infoview, to get LogonToken then send it to ASPX Application. The ASPX Application needs LogonToken to use with logonwithtoken(LogonToken) and this way can open other Webi Reports from that ASPX Application. So, My question is if exists any way to get the logonToken without to use sessionMgr.logon(userID, password, CMS, auth), because already log on in Infoview.

Sorry for my English… I don´t know if you understand my situation.

Thanks for you response,

Best Regards,

:crazy_face:


russell :panama: (BOB member since 2006-08-12)

I was looking into webapps some jsp but could not see anything. I have seen some jsps where use following statements:

IEnterpriseSession boeSession = ActionHelper.getEnterpriseSession(request);
session.setAttribute(“boeSession”, boeSession);
String wcaToken = boeSession.getLogonTokenMgr().createWCAToken("", 1000, 1000);

The jsp file is call view.jsp. This is in Tomcat55\webapps\Xcelsius\jsp\Flash_View.

I tried to use this code but doesn’t work.

Regards,


russell :panama: (BOB member since 2006-08-12)

Since you took this from a page on the InfoView application then this would only work on your code if your code is also host on the same InfoView application.
However, if your code is located in another application then it will not be able to execute ActionHelper.getEnterpriseSession() properly.

What you can do is create an intermediary page on the InfoView application.
This page will use the code that you got from the view.jsp and pass the wcaToken to your application.


darcstorm :philippines: (BOB member since 2008-07-22)

“What you can do is create an intermediary page on the InfoView application.
This page will use the code that you got from the view.jsp and pass the wcaToken to your application”

Yes, exactly. From infoview I invoke another application wrote in ASPX.NET but this need logontoken to connect to CMS and execute a webi report. I don’t know if BO XI 3.1 use constants, or session variables where store the token. In XI R2 version the code got from openFlash.jsp work it. this jsp is in C:\Program Files\Business Objects\Tomcat\webapps\businessobjects\enterprise115\desktoplaunch\InfoView\plugin\crystalenterprise\flash\

this is the code in XI R2 SP2:

[b][i]
<%@ page language=“java” contentType=“text/html;charset=utf-8” %>

<%@ page session=“true” %>
<%@ page import=“com.crystaldecisions.ePortfolio.framework.common.CrystalIdentity,
com.crystaldecisions.webapp.CEConstants,
com.crystaldecisions.webapp.util.html.Encoder” %>

<jsp:useBean id=“CE_Session” type=“com.crystaldecisions.ePortfolio.framework.common.CrystalIdentity” scope=“session”/>

<% String sContext = “…/…/…/…”; %>
<%
response.setHeader(“Cache-Control”,“no-cache”); //HTTP 1.1
response.setHeader(“Pragma”,“no-cache”); //HTTP 1.0
response.setDateHeader (“Expires”, 0); //prevents caching at the proxy server

String sDocId = request.getParameter (“DocumentId”);
if(sDocId == null)
sDocId = request.getParameter(“iDocID”);

CrystalIdentity identity = (CrystalIdentity)
request.getSession().getAttribute(CEConstants.SESSION_EN_SESSION);
// log on token for passing flash vars
String flashvar = “CELogonToken=” + Encoder.encodeURL(identity.getLogonToken());

// append Web Connector URL configurtion
ServletContext context = getServletConfig().getServletContext();
String webUrl = context.getInitParameter(“crystalxcelsius.webconnectorurl”);
if(webUrl != null && webUrl.length() > 0)
flashvar += “&CEWebServiceURL=” + Encoder.encodeURL(webUrl);
[/b][/i]

String flashvar = “CELogonToken=” + Encoder.encodeURL(identity.getLogonToken()); <-- This statement get logontoken.

Well, in XI 3.1 the jsp is called view.jsp and the code is some diferent.

In my ASPX application I use some like this:
[b][i]
SessionMgr sessionMgr = new SessionMgr();
//InfoStore infoStore;
//EnterpriseService enterpriseService;

        enterpriseSession = sessionMgr.LogonWithToken(ls_CELogonToken);

[/b][/i]

My problem is how to get the LogonToken from Infoview.

I’m migrating BOXIR2 to XI 3.1.

Thanks,

Best Regards,[/b]


russell :panama: (BOB member since 2006-08-12)

I don’t know for sure but the following code seems to be the what you need:

((CrystalIdentity)request.getSession().getAttribute(InfoViewConstants.INFOVIEW_SESSION)).getSession()

This code was used in the home.jsp file located in C:\Program Files\Business Objects\Tomcat55\webapps\InfoViewApp\jsp\listing


darcstorm :philippines: (BOB member since 2008-07-22)

Hi darcstorm,

Thanks,

Is InfoViewConstants a package?. I don’t know what jar contains this classes.

Best Regards,


russell :panama: (BOB member since 2006-08-12)

It is imported as follows on home.jsp:

<%@ page import="com.businessobjects.infoview.common.InfoViewConstants"%>

darcstorm :philippines: (BOB member since 2008-07-22)

Thanks,

I will make a test.

Best Regards,


russell :panama: (BOB member since 2006-08-12)

Hi darcstorm,

Work it!.. Thanks very much!

Best Regards,


russell :panama: (BOB member since 2006-08-12)

Hi Everyone,

Where is the class CrystalIdentity located? (i.e In which Jar file)

Thanks.


e-nnovation (BOB member since 2007-11-05)

Hi,

Its works like champs.

Thanks to everyone especially to Darcstorm.

Thanks a lot :slight_smile:

  • JB

Jayabal :india: (BOB member since 2009-01-05)

Please you can post the complete code as I am in need of it as well.


makadiar (BOB member since 2007-07-02)

Hi,

This is a little extract of my jsp code. I cant remember what package is it exactly you need. Just make a test and let me know later.

<%@ page contentType=“text/html; charset=UTF-8” %>
<%@ page import=“com.crystaldecisions.sdk.exception.SDKException” %>
<%@ page import=“com.crystaldecisions.sdk.framework.CrystalEnterprise” %>
<%@ page import=“com.crystaldecisions.sdk.framework.IEnterpriseSession” %>
<%@ page import=“com.crystaldecisions.sdk.framework.ISessionMgr” %>
<%@ page import=“com.crystaldecisions.sdk.occa.infostore.IInfoStore” %>
<%@ page import=“com.crystaldecisions.sdk.occa.managedreports." %>
<%@ page import="com.crystaldecisions.sdk.occa.security.
” %>
<%@ page import=“com.crystaldecisions.sdk.occa.security.ILogonTokenMgr” %>
<%@ page import=“com.businessobjects.webutil.Encoder” %>
<%@ page import=“com.businessobjects.webutil.clientaction.ActionHelper” %>
<%@ page import=“com.businessobjects.webutil.clientaction.ActionData”%>
<%@ page import=“com.crystaldecisions.sdk.framework.CrystalEnterprise”%>
<%@ page import=“com.crystaldecisions.sdk.framework.IEnterpriseSession”%>
<%@ page import=“com.businessobjects.webutil.CookieHelper”%>
<%@ page import=“javax.servlet.http.Cookie” %>
<%@ page import=“com.businessobjects.sdk.plugin.desktop.infoview.IInfoView”%>
<%@ page import=“com.businessobjects.infoview.common.CrystalIdentity”%>
<%@ page import=“com.businessobjects.infoview.common.InfoViewConstants”%>
<%@ page import=“com.businessobjects.infoview.common.Utilities”%>
<%@ page import=“com.crystaldecisions.sdk.occa.infostore.IInfoObjects” %>
<%@ page import=“com.businessobjects.sdk.plugin.desktop.infoview.PreferenceConstants”%>
<%@ page import=“com.businessobjects.webutil.Encoder”%>
<%@ page import=“com.crystaldecisions.webapp.util.html.WebUtils”%>
<%@ page import=“com.crystaldecisions.sdk.plugin.CeKind”%>
<%@ page import=“com.businessobjects.sdk.plugin.desktop.clientaction.IClientActionCore”%>
<%@ page import=“java.util.Locale”%>
<%@ page import=“java.util.ArrayList” %>
<%@ page import=“java.util.Hashtable” %>
<%@ page import=“com.businessobjects.webutil.ClientUtils”%>

<%
String token = ((CrystalIdentity)request.getSession().getAttribute(InfoViewConstants.INFOVIEW_SESSION)).getSession().getLogonTokenMgr().getDefaultToken();

out.println(“<SCRIPT language="javascript"> " +
" alert (" Information: " +
" Token:”+ token + “");”);
%>

regards,

Russell.

B.O.C.P
BusinessObjects XI 3.1 + Xcelsius 2008 SP1 + Sybase IQ + C# .NET 2.0 + JSP Development.
:mrsbob:


russell :panama: (BOB member since 2006-08-12)

thanks for the quick post but i am not able to make it work for 3.1


makadiar (BOB member since 2007-07-02)

Hi all,

I tried your solution but when i launch my JSP Page, I have this error

Erreur de servlet générée:
D:\Applis\Business Objects\Tomcat\work\Catalina\localhost\myapplication\org\apache\jsp\page_005fde_005fgarde_jsp.java:6: package com.crystaldecisions.sdk.exception does not exist
import com.crystaldecisions.sdk.exception.SDKException;
                                          ^

Erreur de servlet générée:
D:\Applis\Business Objects\Tomcat\work\Catalina\localhost\myapplication\org\apache\jsp\page_005fde_005fgarde_jsp.java:7: package com.crystaldecisions.sdk.framework does not exist
import com.crystaldecisions.sdk.framework.CrystalEnterprise;

I assume it’s due to class that are not found… But what can I do? Where do I have to put my class (in my ‘myapplication’ folder?

I’m newbi in terms of development, any help would be greatly appreciated :lol:

thanks in advance

Cedrick


cedrickb :fr: (BOB member since 2005-08-19)

Well I hope you found allready…

What you should do :

copy a jsp page from InfoViewApp webapps in BOXI Tomcat.
clean it up but keep the class imports
from this page you can get the token using Crystal function and then do a proper logonwithtoken with standard JDK.

Hope this helps !


eljuggy (BOB member since 2008-05-15)

Hi, excuse me for raising another question on this old thread, but I kept trying with this code and all I get is an error, because in my app’s scope, the call:

String token = ((CrystalIdentity)request.getSession().getAttribute(InfoViewConstants.INFOVIEW_SESSION)).getSession().getLogonTokenMgr().getDefaultToken();

bounces an error caused by a null value, whereas the very same call under InfoViewApp returns correctly.

Of course I created my own application, at the same level of infoViewApp and others, and I would like to retrieve the user session so to retrieve an open report from its storage token. Does anybody have a clue about this?

Tanks a lot in advance


CLS69 :it: (BOB member since 2009-06-11)