cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a logon page for InfoView with hardcoded username and password

former_member283957
Participant
0 Kudos

Dear all,

I have created a logon page for Infoview with hardcoded username and password but it does not work.

Please see code below.

Thanks in advance.

Antonio

<%@ 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="java.io., java.net., javax.servlet., java.util."%>

{

String authMethod = "secEnterprise";

/* Log on using the Enterprise SDK */

String userID = "curso_2013";

String userPwd = "Curso2013&&";

String cmsName = request.getServerName()+":6400";

try {

IEnterpriseSession enterpriseSession = CrystalEnterprise.getSessionMgr().logon(userID, userPwd, cmsName, authMethod);

session.setAttribute("EnterpriseSession", enterpriseSession);

IInfoStore iStore = (IInfoStore)enterpriseSession.getService("InfoStore");

session.setAttribute("InfoStore", iStore);

String logonToken = enterpriseSession.createLogonToken();

String openDocURL="http://xp-sp3-limpio:8080/InfoViewApp/logon/start.do?ivsLogonToken=" + logonToken;

response.sendRedirect(openDocURL);

} catch(Exception e) {

out.println("Error: User, Password or CMS name is wrong or Not all parameters sent by URL");

}

}

No se puede compilar la clase para JSP Error de servlet generado: Syntax error on token ".", Identifier expected after this token Error de servlet generado: Syntax error on token ".", Identifier expected after this token Error de servlet generado: Syntax error on token ".", Identifier expected after this token Error de servlet generado: Syntax error on token ".", Identifier expected after this token Ha tenido lugar un error en la línea: 15 en el archivo jsp: /logonpruebaok2.jsp Error de servlet generado: The method createLogonToken() is undefined for the type IEnterpriseSession

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Antinio,

The method you are using to create a token doesnot exist for the IEnterpriseSession interface and the same is stated in the error message.

use the below code which works:

<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*,

com.crystaldecisions.sdk.plugin.desktop.common.*,

com.crystaldecisions.sdk.framework.*,

com.crystaldecisions.sdk.occa.security.*,

com.crystaldecisions.sdk.exception.SDKException,

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory,

java.util.Locale,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"

%>

<%

IEnterpriseSession enterpriseSession;

String serializedSession;

/* Set Enterprise Logon credentials. */

final String BO_CMS_NAME = "Your CMS Name";

final String BO_AUTH_TYPE = "Your Auth Type";

final String BO_USERNAME = "Your User Name";

final String BO_PASSWORD = "Your Password";

/*Set Java InfoView start page URL */

final String INFOVIEW_URL = "http://localhost:8080/InfoViewApp/logon/start.do";

/* Log onto Enterprise and serialize the Enterprise Session. */

enterpriseSession = CrystalEnterprise.getSessionMgr().logon(BO_USERNAME, BO_PASSWORD, BO_CMS_NAME, BO_AUTH_TYPE);

serializedSession = enterpriseSession.getSerializedSession();

/* Redirect to InfoView, passing the serialized Enterprise Session. */

response.sendRedirect(INFOVIEW_URL + "?ivsLogonSession=" + java.net.URLEncoder.encode(serializedSession));

%>

The above code is using the serialized session to login.

You can also use tokens if you need.

Please download the developers guide and API reference from the following links for better understanding about how the SDKs work

http://help.sap.com/businessobject/product_guides/boexir31/en/boesdk_java_dg_12_en.zip

http://help.sap.com/businessobject/product_guides/boexir31/en/boesdk_java_apiRef_12_en.zip

Regards,

prithvi

former_member283957
Participant
0 Kudos

Hi Prithvi,

Thank you very much for your answer.

I have updated your two codes using my parameters and the name of my host.

Both codes give me the same error, please let me know how to fix the code

Thanks in advance.

Kind Regards.

Antonio

Error:

No se puede compilar la clase para JSP Error de servlet generado: Only a type can be imported. com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory resolves to a package Error de servlet generado: Only a type can be imported. com.crystaldecisions.report.web.viewer.CrystalReportViewer resolves to a package Error de servlet generado: Only a type can be imported. com.crystaldecisions.sdk.occa.report.reportsource.IReportSource resolves to a package

Please see the two codes below with theirs errors.

<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*,

com.crystaldecisions.sdk.plugin.desktop.common.*,

com.crystaldecisions.sdk.framework.*,

com.crystaldecisions.sdk.occa.security.*,

com.crystaldecisions.sdk.exception.SDKException,

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory,

java.util.Locale,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"

%>

<%

IEnterpriseSession enterpriseSession;

String serializedSession;

/* Set Enterprise Logon credentials. */

final String BO_CMS_NAME = request.getServerName()+":6400";

final String BO_AUTH_TYPE = "secEnterprise";

final String BO_USERNAME = "curso_2013";

final String BO_PASSWORD = "Curso2013&&";

/*Set Java InfoView start page URL */

final String INFOVIEW_URL = "http://xp-sp3-limpio:8080/InfoViewApp/logon/start.do";

/* Log onto Enterprise and serialize the Enterprise Session. */

enterpriseSession = CrystalEnterprise.getSessionMgr().logon(BO_USERNAME, BO_PASSWORD, BO_CMS_NAME, BO_AUTH_TYPE);

serializedSession = enterpriseSession.getSerializedSession();

/* Redirect to InfoView, passing the serialized Enterprise Session. */

response.sendRedirect(INFOVIEW_URL + "?ivsLogonSession=" + java.net.URLEncoder.encode(serializedSession));

%>


No se puede compilar la clase para JSP Error de servlet generado: Only a type can be imported. com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory resolves to a package Error de servlet generado: Only a type can be imported. com.crystaldecisions.report.web.viewer.CrystalReportViewer resolves to a package Error de servlet generado: Only a type can be imported. com.crystaldecisions.sdk.occa.report.reportsource.IReportSource resolves to a package

<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*,

com.crystaldecisions.sdk.plugin.desktop.common.*,

com.crystaldecisions.sdk.framework.*,

com.crystaldecisions.sdk.occa.security.*,

com.crystaldecisions.sdk.exception.SDKException,

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory,

java.util.Locale,

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource"

%>

<%

IEnterpriseSession enterpriseSession;

String serializedSession;

/* Set Enterprise Logon credentials. */

final String BO_CMS_NAME = request.getServerName()+":6400";

final String BO_AUTH_TYPE = "secEnterprise";

final String BO_USERNAME = "curso_2013";

final String BO_PASSWORD = "Curso2013&&";


/*Set Java InfoView start page URL */

final String INFOVIEW_URL = "http://xp-sp3-limpio:8080/InfoViewApp/logon/start.do";

/* Log onto Enterprise and serialize the Enterprise Session. */

enterpriseSession = CrystalEnterprise.getSessionMgr().logon(BO_USERNAME, BO_PASSWORD, BO_CMS_NAME, BO_AUTH_TYPE);

ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr();

String token= logonTokenMgr.createLogonToken("xp-sp3-limpio",10,10);

/* Redirect to InfoView, passing the token. */

response.sendRedirect(INFOVIEW_URL + "?ivsLogonToken=" + java.net.URLEncoder.encode(token));

%>

No se puede compilar la clase para JSP Error de servlet generado: Only a type can be imported. com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory resolves to a package Error de servlet generado: Only a type can be imported. com.crystaldecisions.report.web.viewer.CrystalReportViewer resolves to a package Error de servlet generado: Only a type can be imported. com.crystaldecisions.sdk.occa.report.reportsource.IReportSource resolves to a package

Former Member
0 Kudos

Hi antonio,

Remove theses import statements.

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory

You application are missing the jars which contain theses pakages.

also you donot need these packages at the first place for this workflow.

So just removing them will make it work.

thanks

former_member283957
Participant
0 Kudos

Hi Prithvi,

Thank you very much for your answer.

Finally the logon page is working properly.

I wrote  .* at the end of these import statements below  and I also wrote right values for the parameters

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory.*,

com.crystaldecisions.report.web.viewer.CrystalReportViewer.*,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource.*"

The code below WORKS 🙂 but let me know please if I must remove theses import statements from there  code below.

com.crystaldecisions.report.web.viewer.CrystalReportViewer,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory

or just I must keep them  as:

com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory.*,

com.crystaldecisions.report.web.viewer.CrystalReportViewer.*,

com.crystaldecisions.sdk.occa.report.reportsource.IReportSource.*"

<%@ page import = "com.crystaldecisions.sdk.occa.infostore.*,
com.crystaldecisions.sdk.plugin.desktop.common.*,
com.crystaldecisions.sdk.framework.*,
com.crystaldecisions.sdk.occa.security.*,
com.crystaldecisions.sdk.exception.SDKException,
com.crystaldecisions.sdk.occa.managedreports.IReportSourceFactory.*,
java.util.Locale,
com.crystaldecisions.report.web.viewer.CrystalReportViewer.*,
com.crystaldecisions.sdk.occa.report.reportsource.IReportSource.*"
%>
<%
try {
IEnterpriseSession enterpriseSession;
String serializedSession;
/* Set Enterprise Logon credentials. */
final String BO_CMS_NAME = request.getServerName()+":6400";
final String BO_AUTH_TYPE = "secEnterprise";
final String BO_USERNAME = "USER";
final String BO_PASSWORD = "PASSWORD";
/*Set Java InfoView start page URL */
final String INFOVIEW_URL = "http://server/InfoViewApp/logon/start.do";
/* Log onto Enterprise and serialize the Enterprise Session. */
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(BO_USERNAME, BO_PASSWORD, BO_CMS_NAME, BO_AUTH_TYPE);
ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr();
String token= logonTokenMgr.createLogonToken("computer name",10,10);
/* Redirect to InfoView, passing the token. */
response.sendRedirect(INFOVIEW_URL + "?ivsLogonToken=" + java.net.URLEncoder.encode(token));} catch(Exception e) {
out.println("Error: User, Password or CMS name is wrong or Not all parameters sent by URL");
}

%>

Thanks in advance.

Kind Regards.

Antonio

Former Member
0 Kudos

Hi Antionio,

You can remove those import statements as the reference of them is not being used in your code.

Those specific interfaces are used when you are dealing with crystal reports viewing through BOE java sdks.

Thanks,

Prithvi

former_member283957
Participant
0 Kudos

Hi Prithvi,

Thanks a lot for your anwer.

Let me ask you another question.

Please see the Image below.

I want to use the "percertil function" over a measure but it does not work.

The column of percentil gives me the same value of the column "Number of records wich contain the measure "Total expedientes" = Total records

Former Member
0 Kudos

privithi,

need your help to complete the above process.

i have many doubts .

kindly help me out

Former Member
0 Kudos

Let us know you queries. Its better to open a separate thread with your queries and anyone from this community can help you.

Thanks,

Prithvi

Answers (2)

Answers (2)

former_member283957
Participant
0 Kudos

Sorry I cannot help you.

former_member283957
Participant
0 Kudos

Hi Prithvi,

Let me ask you another question.

I have run a query in Oracle and I have got this result.

Number of register   Date  B                  Code

A3124                    24/11/2011            080

A3124                    12/01/2013            300A20

At the report I would like to get only one row for the register A3124  WITH THE DATE FOR THE CODE 300A20

Number of register   Date B

A3124                    12/01/2013       

Let me know how to solve it please.

Thanks in advance.

Kind Regards

Antonio