cancel
Showing results for 
Search instead for 
Did you mean: 

Opendocument.jsp

Former Member
0 Kudos

I am trying to implement opendocument with the log in token. New to this. Environment is SAP BI 4.0 SP6 Java on Windows.

I have 2 questions

1. Where do I store new opendocument.jsp that I am creating

2. I do not understand the reason for this code in opendocument.jsp (this is taken from the example in the SAP document xi4_opendocument_en.pdf)

return ("http://<server>:<port>/BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=Aa6GrrM79cRAmaOSMGoad

KI&sIDType=CUID&token=" + tokenEncode)

If the user calls in the urls with the new documents all the time does the code

iDocID=Aa6GrrM79cRAmaOSMGoadKI&sIDType=CUID from the url above limits to same document.

I am sure I do not understand this but can anyone explain how can I pass security token for multiple users calling multiple opendocuments

below the code I created for my opendocument.jsp

<%@ 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, java.net.*"

%>

<%

String serializedSession;

/* Set Enterprise Logon credentials. *

    String cms = "";
    String username = "";
    String password = "";
    String auth = "secEnterprise";
    IEnterpriseSession enterpriseSession;
    String token = "";

/

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

enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cms, auth);

String logonToken = enterpriseSession.getLogonTokenMgr().createLogonToken("",30,100);

String tokenEncode = URLEncoder.encode(logonToken, "utf-8");

String url = "http://<server>:8080/BOE/OpenDocument/opendoc/openDocument.jsp?token=" + tokenEncode+"&iDocID=AeKTiOvM_DpBgQ9xiEPt7NE&sIDType=CUID";

response.sendRedirect(url);

%>

I will appreciate all the comments and responses.

Regards,

Igor Cotler

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Igor,

Let me give a heads up first which might be helpful.

OpenDocument url reporting is a technique where an url is constructed according to the guide available at
http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_opendocument_en.pdf


An example url can be
http://<server>:<port>/BOE/OpenDocument/opendoc/openDocument.jsp?iDocID=Aa6GrrM79cRAmaOSMGoadKI&sIDT...

In the above url we pass the document cuid as a parameter to open a particular report based on the CUID.

If you execute the above url directly in the internet browser, you would be asked to enter your BusinessObjects credentials and post that you would be able to view that particular report.

If you want to embedd this in your portal and you do not want your users to enter credentials while hitting on the open document url, you need to attach a valid token with the opendocument url.

The token is generated from a valid enterprise session which you can generate using the businessobjects sdks.Your code does the same.

Now as far as your query goes,
If you will hard code the document CUID in your code, then you will always be opening the same document/report.


So you would need to opt for dynamically passing the document CUID. Below are the steps how it can be done.

1. Login to Enterprise.
enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cms, auth);
2. Get the infostore Service and query for the report you need to view using open document. Query either by ID/Name.

IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService("","InfoStore");
String query = "select * from ci_infoobjects where si_kind='reportkind' and si_instance = 0 and SI_NAME='XYZ'"
IInfoObjects oInfoObjects = oInfoStore.query(query);

3. Now retrieve the report CUID
IInfoObject oInfoObject=(IInfoObject)oInfoObjects.get(0);
String reportCUID=oInfoObject.getCUID();

4. Once you have a document CUID, you would then pass this to OpenDocument URL
http://<server>:8080/BOE/OpenDocument/opendoc/openDocument.jsp?token=" + tokenEncode+"&iDocID="+reportCUID+"&sIDType=CUID";

This way you make the url dynamic. Similarly, you would need to take the user credentials dynamically and pass to your page to generate a session and eventually a token.

If I take an example of login page where you enter user name and password, I would get the parameters to my jsp something like below.
String username = request.getParameter("username");
String password = request.getParameter("password");


Thanks,
Prithvi

Former Member
0 Kudos

Thanks Prithvi,

Your insites are very helpful. However you did not addressed my first question

Where do I store new opendocument.jsp that I am creating?

Can you elaborate on this one.

Regards,

Igor Cotler

Former Member
0 Kudos

Hello Igor,

You would need to create your own application context(.WAR)

Below are example steps to create a war in tomcat application server which comes with BusinessObjects

1. Create a folder for example Test inside the following location /tomcat/webapps

2. Create another folder as WEB-INF inside the Test folder(/tomcat/webapps/Test/WEB-INF)

3. Create a folder named as lib inside WEB-INF folder(/tomcat/webapps/Test/WEB-INF/lib)

4. Copy the required jars from the following two location and copy them inside the lib folder(/tomcat/webapps/Test/WEB-INF/lib/)

<BusinessObjects Installtion Directory>/SAP BusinessObjects/SAP BusinessObjects XI 4.0/java lib

<BusinessObjects Installtion Directory>/SAP BusinessObjects/SAP BusinessObjects XI 4.0/java lib

5. Copy your custom opendocument.jsp files inside the Test folder we created in Step 1(/tomcat/webapps/Test/test.jsp)

6. Restart the Tomcat application server and excute the url

https://<server>:<port>/Test/test.jsp

(Above I am considering the jsp file name as test)

Note: The required list of jars can be found from the developers guide available at

http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_boejava_dg_en.zip

Refer to section 'JAR files needed for deployment of SAP BusinessObjects software' under Setting Up Development environment--> Web Application Setup.

Thanks,

Prithvi

Former Member
0 Kudos

Thanks Prithvi,

You mentioned 2 jar locations but the path for the second is the same as the first one. Can you confirm the second one.

Regards,

Igor Cotler

Former Member
0 Kudos

Sorry for the typo.

The second path is <BusinessObjects Installtion Directory>/SAP BusinessObjects/SAP BusinessObjects XI 4.0/java/lib/external

Thanks,

Prithvi

Former Member
0 Kudos

Thanks Prithvi,

I thought so that this is one of the extra folders with in the lib folder.

After flowing your instructions I am successfully can log in in to the BI ( I can verify this by looking at the sessions in CMC). However I am not retrieving the document. Below are the steps I took.

1. Created the folders

C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\testIC

C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\testIC\WEB-INF

C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\testIC\WEB-INF\lib

2. Copied jar files and the content of the folder external  from

C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib

to

C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\testIC\WEB-INF\lib

C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\testIC\WEB-INF\lib\external

3. Created the jsp file openDocument.jsp and saved it in

C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\testIC

this is the code form the new openDocument.jsp file. Note: I did not yet follow your suggestion to use

String username = request.getParameter("username");

String password = request.getParameter("password");

I wanted to see if I can do it with the hard coded values before I can start modifying the jsp.

Note: cms, username and password are intentionally left blank here values are hard coded in my environment

<%@ 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, java.net.*"

%>

<%

String serializedSession;

/* Set Enterprise Logon credentials. */

        String cms = "";

        String username = "";

        String password = "";

        String auth = "secEnterprise";

        IEnterpriseSession enterpriseSession;

        String token = "";

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

enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password,cms, auth);

String logonToken = enterpriseSession.getLogonTokenMgr().createLogonToken("",30,100);

String tokenEncode = URLEncoder.encode(logonToken, "utf-8");

%>


4. Restarted the Tomcat.

5. the URL was run from IE on the server the second URL was run form the laptop on the network

http://localhost:8080/testIC/openDocument.jsp?sIDType=CUID&iDocID=AfTbB1xCfQFLixKrcLSn.to&token=toke...

http://<servername>:8080/testIC/openDocument.jsp?sIDType=CUID&iDocID=AfTbB1xCfQFLixKrcLSn.to&token=t...

The results are the same. Able to log in into the system credentials are passed through the token (verified through CMC) but the document requested does not coming back. The document is the test document without any prompts.

Any mistakes do you see in my code or steps. Can you make any suggestions to debug the problem.

Regards,

Igor Cotler

Former Member
0 Kudos

Hi Igor,

The urls you are using is incorrect.

You need to construct the opendocument urls and pass that through your code.

Below is a snippet taken from your post

=================================

<%@ 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, java.net.*"

%>

<%

/* Set Enterprise Logon credentials. *

    String cms = "";
    String username = "";
    String password = "";
    String auth = "secEnterprise";
    IEnterpriseSession enterpriseSession;
    String token = "";

/

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

enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cms, auth);

String logonToken = enterpriseSession.getLogonTokenMgr().createLogonToken("",30,100);

String tokenEncode = URLEncoder.encode(logonToken, "utf-8");

String url = "http://<server>:8080/BOE/OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=AfTbB1xCfQFLixKrc...

response.sendRedirect(url);

%>

=================================

The above code has to be saved as a .jsp file in the testIC folder you created.for example test.jsp

Then in the browser you would need to execite the url

http://localhost:8080/testIC/test.jsp (If running from your local environment) and

http://<servername>:<port>/testIC/test.jsp (When running from network)

Please test the same and let me know if you still not able to see the document?

Thanks,

Prithvi

Former Member
0 Kudos

Thanks Prithvi,

It finally worked. At the end I found another problem. Some one hard coded the name of different server in the OpenDocument.properties and this why I was able to log in but could not retrieve the document.

Thanks again for your help.

Regards,

Igor Cotler

former_member196113
Participant
0 Kudos

Hi,

When following the procedure above a get the following error:

HTTP Status 500 - java.lang.ClassNotFoundException: org.apache.jsp.openDocument_jsp

--------------------------------------------------------------------------------

type Exception report

message java.lang.ClassNotFoundException: org.apache.jsp.openDocument_jsp

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.openDocument_jsp

    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:177)

    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

root cause

java.lang.ClassNotFoundException: org.apache.jsp.openDocument_jsp

    java.net.URLClassLoader$1.run(URLClassLoader.java:255)

    java.security.AccessController.doPrivileged(Native Method)

    java.net.URLClassLoader.findClass(URLClassLoader.java:243)

    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)

    org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)

    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)

    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.55 logs.

Br

Steven

Answers (0)