on 08-25-2010 4:28 AM
我希望直接打开URL查看报表,而避免登陆.请教大家,谢谢。
比如:http://server8080/OpenDocument/opendoc/openDocument.jsp?iDocID=5566
我的代码如下【验证方式是 SAP验证】,每次这代码还会弹出一个登陆验证框,输入密码后才能登陆,
很郁闷,难道我传递的stoken参数没起作用?
我希望避开验证密码框而直接登录。 谢谢大家
我的test.jsp放在 OpenDocument/opendoc/ 目录下。
对应代码如下
<%@ page import="com.crystaldecisions.sdk.framework.*" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.occa.pluginmgr.IPluginFactory"%>
<%
boolean loginSuccessful = false;
IEnterpriseSession boEnterpriseSession = null;
String SAPSystemId = "BWD";
String SAPClientId = "900";
String SAPUsername = "BOU";
String username = SAPSystemId + "~" + SAPClientId + "/" + SAPUsername;
String password = "654321";
String cmsname = "ITTEST:6400";
String authenticationType = "secSAPR3";
try {
//Log in.
boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authenticationType);
if (boEnterpriseSession == null) {
out.print("Unable to login.");
} else {
loginSuccessful = true;
}
} catch (SDKException sdkEx) {
out.print("ERROR ENCOUNTERED" + sdkEx + "");
}
if (loginSuccessful){
ILogonTokenMgr boLogonTokenMgr = boEnterpriseSession.getLogonTokenMgr();
String logonToken = boLogonTokenMgr.createLogonToken("", 60, 1);
String infoViewURL =null;
String tokenParam =null;
String redirectURL =null;
infoViewURL="http://server:8080/OpenDocument/opendoc/logon.jsp";
tokenParam = "ivsLogonToken=" + logonToken;
redirectURL = infoViewURL + "&" + tokenParam;
//response.sendRedirect(redirectURL);
String sdocid= "5566";
pageContext.forward("openDocument_oa.jsp?iDocID="sdocid"&token="+tokenParam);
}
%>
>
> 我希望直接打开URL查看报表,而避免登陆.请教大家,谢谢。
>
> 比如:http://server8080/OpenDocument/opendoc/openDocument.jsp?iDocID=5566
>
> 我的代码如下【验证方式是 SAP验证】,每次这代码还会弹出一个登陆验证框,输入密码后才能登陆,
> 很郁闷,难道我传递的stoken参数没起作用?
>
> 我希望避开验证密码框而直接登录。 谢谢大家
>
>
> 我的test.jsp放在 OpenDocument/opendoc/ 目录下。
>
>
>
>
> 对应代码如下
> <%@ page import="com.crystaldecisions.sdk.framework.*" %>
> <%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
> <%@ page import="com.crystaldecisions.sdk.occa.pluginmgr.IPluginFactory"%>
> <%
> boolean loginSuccessful = false;
> IEnterpriseSession boEnterpriseSession = null;
>
> String SAPSystemId = "BWD";
> String SAPClientId = "900";
> String SAPUsername = "BOU";
> String username = SAPSystemId + "~" + SAPClientId + "/" + SAPUsername;
> String password = "654321";
> String cmsname = "ITTEST:6400";
> String authenticationType = "secSAPR3";
>
> try {
> //Log in.
> boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authenticationType);
> if (boEnterpriseSession == null) {
> out.print("Unable to login.");
> } else {
> loginSuccessful = true;
> }
> } catch (SDKException sdkEx) {
> out.print("ERROR ENCOUNTERED" + sdkEx + "");
> }
>
>
> if (loginSuccessful){
> ILogonTokenMgr boLogonTokenMgr = boEnterpriseSession.getLogonTokenMgr();
> String logonToken = boLogonTokenMgr.createLogonToken("", 60, 1);
> String infoViewURL =null;
> String tokenParam =null;
> String redirectURL =null;
>
> infoViewURL="http://server:8080/OpenDocument/opendoc/logon.jsp";
>
> tokenParam = "ivsLogonToken=" + logonToken;
> redirectURL = infoViewURL + "&" + tokenParam;
> //response.sendRedirect(redirectURL);
>
> String sdocid= "5566";
> pageContext.forward("openDocument_oa.jsp?iDocID="sdocid"&token="+tokenParam);
> }
> %>
在你的代码中,tokenParam=logonToken 就可以了,不需要加"ivsLogonToken="
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
备注 我的验证代码
loginSuccessful = true 这个是成功的。
说明验证没问题。
但是我想知道验证后,怎么在Opendocument.jsp 里 告诉他们我其实已经登录过了?
我有尝试修改 Opendocument.jsp
利用:
boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authenticationType);
String sToken = boEnterpriseSession.getLogonTokenMgr().createLogonToken("",120,2);
然后后续,在
String token=request.getParameter("token");
这后面补充我的:
if(token == null)
{
token = sToken;
}
但是当我:
http://server:8080/OpenDocument/opendoc/openDocument_oa.jsp?iDocID=5566
时,仍然是弹出了登陆框。
请教大家了,非常感谢。
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.