Hi
I use jdeveloper 11.1.1.3.0
My requirement is to create a Web Service that returns a PDF file or a image.
I first created a report in Jasper Report and then I call this report as a PDF file through a method in a bean and the PDF file display successfully in ADF application
public void runReport(String repPath, java.util.Map param) throws Exception {
Connection conn = null;
try {
HttpServletResponse response = getResponse();
ServletOutputStream out = response.getOutputStream();
response.setHeader("Cache-Control", "max-age=0");
response.setContentType("application/pdf");
ServletContext context = getContext();
InputStream fs = context.getResourceAsStream("/reports/" + repPath);
JasperReport template = (JasperReport)JRLoader.loadObject(fs);
template.setWhenNoDataType(WhenNoDataTypeEnum.NO_DATA_SECTION);
conn = getConnection();
JasperPrint print = JasperFillManager.fillReport(template, param, conn);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(print, baos);
out.write(baos.toByteArray());
out.flush();
out.close();
FacesContext.getCurrentInstance().responseComplete();
} catch (Exception jex) {
jex.printStackTrace();
}
}
but I can't create a web service from this method
what is the solution for this problem?
Habib