我写了一个java代理来获取ssrs 2008的深入报告。如果我通过报告服务器URL访问它,它的工作完全正常,但在我的java spring应用程序中,它失去了功能。例如,我有一个向下钻取报告,如果我单击加号以展开它它在ssrs url中工作,但在我的jsp中,渲染的html没有,它必须像我使用报告服务器URL一样工作。这是我的代码示例,请告诉我这是否可行。
public String getReport(String ReportUrl) throws Exception
{
ReportExecutionServiceSoapStub service = getService();
ExecutionInfo info = service.loadReport(ReportUrl, null); //Load report
info.setHasDocumentMap(false);
setExecutionId(service, info.getExecutionID()); //You must set the session id before continuing
String format = "HTML4.0"; //Valid options are HTML4.0, MHTML, EXCEL, CSV, PDF, etc
String deviceInfo = "<DeviceInfo><Toolbar>True</Toolbar></DeviceInfo>"; //Only generate an HTML fragment
ByteArrayHolder result = new ByteArrayHolder();
StringHolder extension = new StringHolder();
StringHolder mimeType = new StringHolder();
StringHolder encoding = new StringHolder();
ArrayOfWarningHolder warnings = new ArrayOfWarningHolder();
ArrayOfStringHolder streamIDs = new ArrayOfStringHolder();
service.render(format, deviceInfo, result, extension, mimeType, encoding, warnings, streamIDs); //Render report to HTML
System.out.println(new String(result.value)); //Prints the report HTML; this could be embedded in a JSP
return new String(result.value);
}
public static void setExecutionId(ReportExecutionServiceSoapStub service, String id) throws SOAPException
{
SOAPHeaderElement sessionHeader = new SOAPHeaderElement("http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", "ExecutionHeader");
sessionHeader.addChildElement("ExecutionID").addTextNode(id);
service.setHeader(sessionHeader);
}
public static ReportExecutionServiceSoapStub getService() throws Exception{
String endpoint = "http://192.168.69.213/reportserver/ReportExecution2005.asmx";
AuthPolicy.registerAuthScheme(AuthPolicy.NTLM, JCIFS_NTLMScheme.class);
ReportExecutionServiceSoapStub service = (ReportExecutionServiceSoapStub)new ReportExecutionServiceLocator(getEngineConfiguration()).getReportExecutionServiceSoap(new URL(endpoint));
service.setUsername("192.168.69.213\\administrator");
service.setPassword("secret");
return service;
}
public static org.apache.axis.EngineConfiguration getEngineConfiguration()
{
java.lang.StringBuffer sb = new java.lang.StringBuffer();
sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
sb.append("<deployment name=\"defaultClientConfig\"\r\n");
sb.append("xmlns=\"http://xml.apache.org/axis/wsdd/\"\r\n");
sb.append("xmlns:java=\"http://xml.apache.org/axis/wsdd/providers/java\">\r\n");
sb.append("<globalConfiguration>\r\n");
sb.append("<parameter name=\"disablePrettyXML\" value=\"true\"/>\r\n");
sb.append("<parameter name=\"enableNamespacePrefixOptimization\" value=\"true\"/>\r\n");
sb.append("</globalConfiguration>\r\n");
sb.append("<transport name=\"http\" pivot=\"java:org.apache.axis.transport.http.CommonsHTTPSender\"/>\r\n");
sb.append("<transport name=\"local\" pivot=\"java:org.apache.axis.transport.local.LocalSender\"/>\r\n");
sb.append("<transport name=\"java\" pivot=\"java:org.apache.axis.transport.java.JavaSender\"/>\r\n");
sb.append("</deployment>\r\n");
return new org.apache.axis.configuration.XMLStringProvider(sb.toString());
}
谢谢,任何帮助将不胜感激。
答案 0 :(得分:0)
作为一种可能的解决方案,我将做以下几点。
Ssrs有正负gif图像,你可以下载并包含在你的战争项目中。 用户将单击其中一个分组行,然后我将调用另一个报告以获取分组数据并将正图像替换为负图像。它几乎是钻研工作的方式,除了你做一些逻辑以不同方式构建html 如果您在浏览器中打开报告,请查看其来源以了解要操作的内容。