Home
Analytics
Display a report in java appliaction from BIRT iServer
mama
Hello everyone
I wish to inform you that I use BIRT iServer Version 11,
I connect from a java application to my server via web service, I log into the server and I can execute reports or list all the files, my problem and I can not display the report in my application ,
please help me
Find more posts tagged with
Comments
rmurphy
Take a look at the JavaScript API (JSAPI). This will allow you to seemlessly embed the Actuate BIRT Viewer into your application. There are documented examples that you can browse to within the Information Console located in /Public/JSAPI Examples.
Additionally here is a link to the documentation:
http://www.birt-exchange.com/be/documentation/Manuals11SP2/using-jsapi.pdf
mama
thank you for your reply,
I work with a java application and I use the java client axis to communicate with my server,
I can download the report from the server to download class and stores it on my local machine but I can not display it in my application,
thank you for your help
johnw
Robs suggestion of using the JSAPI is really going to be the easiest and prefered way to go. But if your not using a web application, then you will need to use IDAPI calls directly (which it sounds like you are). You will need to make 2 calls, ExecuteReport or SubmitJob, which will run a report on iSErver, and SelectPage, which will make iServer render to an output format. With select page, you specify what type you want it rendered in (HTML, PDF, WORD, etc), and you will get back a binary string that you will need to decode and display.
mama
Hello johnw ,
thank you for your answer is exactly what I did, but I'm running the report with the class ExecuteReport, and I get the result with download class and I can save back to disk, but displays the result in my java application that's what the problem wonder if you could explain to me how I can use the class SelectPage thank you in advance
johnw
DownloadReport will not download the final output, just the rptdocument or binary ERD report. SelectPage will take those binary reports and render them out. I posted an example here:
http://www.birt-exchange.org/org/forum/index.php/topic/23359-how-to-get-report-content-via-actuate-web-services/page__fromsearch__1
You can also check the documentation at
http://www.birt-exchange.com/be/documentation/Manuals11SP2/using-iserver-integration-tech.pdf
mama
hello Johnw,<br />
thank you for your answer, but I always problem to use the code that you have spent,<br />
Here's the code I execute the report for, unwanted and displays the report rated client.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
import java.lang.reflect.Proxy;
import java.net.URL;
import java.rmi.RemoteException;
import com.actuate.idapi.client.ActuateSession;
import com.actuate.idapi.client.ActuateSessionException;
import com.actuate.idapi.client.ActuateSessionFactory;
import com.actuate.idapi.client.FileDownload;
import com.actuate.idapi.client.ReportSessionBuilder;
import com.actuate.idapi.client.ServerFile;
import com.actuate.idapi.client.Utilities;
import com.actuate.idapi.examples.BaseExample;
import com.actuate.schemas.ActuateSoapBindingStub;
import com.actuate.schemas.ExecuteReportResponse;
import com.actuate.schemas.GetPageCount;
import com.actuate.schemas.GetPageCountResponse;
import com.actuate.schemas.ObjectIdentifier;
import com.actuate.schemas.PageIdentifier;
import com.actuate.schemas.SelectPage;
import com.actuate.schemas.SelectPageResponse;
import com.actuate.schemas.ViewParameter;
public class RunReport extends BaseExample {
public ActuateSoapBindingStub proxy;
private static RunReport m_instance = null;
public String IDAPI_HOST = "localhost";
public int IDAPI_PORT = 8000;
public static void main(String[] args) throws RemoteException, Throwable {
(new RunReport()).runReport();
}
private void runReport( ) throws ActuateSessionException, RemoteException {
String userName = "administrator";
String password = "birtadmin";
URL endpoint = Utilities.makeUrl( IDAPI_HOST, IDAPI_PORT );
ActuateSessionFactory factory = new ActuateSessionFactory( );
ActuateSession session = null;
factory.setDefaultVolume("Birtiserver");
session = factory.login(endpoint,userName, password);
String inputFileName = "/Home/administrator/Mardi2.rptdesign";
ServerFile outputFile = null;
ServerFile reportFile = new ServerFile( session, inputFileName );
try {
System.out.println(reportFile.getFileId());
} catch (RemoteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
ReportSessionBuilder jobBuilder = reportFile.runSyncReport( );
ExecuteReportResponse executeReportResponse = jobBuilder.start( );
ViewParameter param = new ViewParameter();
param.setFormat("Mardi2.PDF");
SelectPage requestPage = new SelectPage();
requestPage.setViewParameter(param);
requestPage .setDownloadEmbedded(true);
ObjectIdentifier objectID = new ObjectIdentifier();
objectID.setId(executeReportResponse.getObjectId());
objectID.setType(executeReportResponse.getOutputFileType());
requestPage.setObject(objectID);
GetPageCount getPageCount = new GetPageCount();
getPageCount.setObject(objectID);
GetPageCountResponse pageCount = proxy.getPageCount(getPageCount);
PageIdentifier pageRange = new PageIdentifier();
pageRange.setRange("1-" + pageCount.getPageCount());
requestPage.setPage(pageRange);
SelectPageResponse pageResponse = proxy.selectPage(requestPage);
byte[] attachment = pageResponse.getPageRef().getContentData();
}
}
</pre>
and even a small thing is that I can not identify the "RunReportsAC10",<br />
thank you again.
mama
hello,<br />
Here is the error that generates this code for me on this line bold:<br />
public ActuateSoapBindingStub proxy;<br />
<strong class='bbc'>GetPageCountResponse pageCount = proxy.getPageCount(getPageCount);</strong><br />
<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
Exception in thread "main" java.lang.NullPointerException
at com.actuate.idapi.client.test.ExecteReportEndDisplay.runReport(ExecteReportEndDisplay.java:94)
at com.actuate.idapi.client.test.ExecteReportEndDisplay.main(ExecteReportEndDisplay.java:47)
</pre>
rmurphy
Do you have the Server Integration Technology package? This package includes several examples, including one to download report pages.
Here is the package:
http://www.birt-exchange.org/org/wiki/index.php?title=Server_Integration_Technology
Once installed, look in the following directory (assuming a default install)
C:\Program Files (x86)\Actuate11\ServerIntTech\Web Services\Examples\Axis Client\Source
johnw
Sorry, RunReportsAC10 is the main class. The WriteOutput method is literally just using an Output Stream (in the case of this example, it is outputting to a PDF file), so it is just wrapping a FileOutputStream and using the byte array returned from SelectPage.
mama
hello everyone,
thank you for your answer, is what you can tell me if I have an error in my code the above,because it generate me an error that posted above,It gives me this error line "GetPageCountResponse pageCount = proxy.getPageCount(getPageCount);"
I'm really stuck on this topic,help me please
mama
Hello johnw
if you like it ,if you can send me the comple code to use the SelectPage class, thank you in advance