Jump to content
We've recently updated our Privacy Statement, available here ×

out_fati

Members
  • Posts

    2
  • Joined

  • Last visited

out_fati's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hi evry one; I'm not able to get a correct xls file from exporting report on rest web service (i'm using API jrs-rest-java-client) asyncronos mode. whene i get .xls file from input stream and i try to open it in Excel it's tel me dat file is corrupted or extention is not good and i clik ok to open it and then i get characters like (ÐÏࡱá>þ) anny idea ? some one can help ? i'm using jasperserver 6.0.3 and jaspersoft studio 6.0.4 my code to get exprted file : public InputStream runAsyncReport(String reportURI, ReportParameters parameters, ReportOutputFormat outPutFormat, Session session) { InputStream file = null; final ReportExecutionRequest.Builder requestBuilder = new ReportExecutionRequest.Builder(); final ReportExecutionRequest request = requestBuilder.setOutputFormat(outPutFormat).setParameters(parameters).setPages(1).setReportUnitUri(reportURI) .setAsync(true).build(); // all requests should be in the same session // As a response we've got `OperationResult` instance which contains HTTP response wrapper final OperationResult<ReportExecutionDescriptor> operationResult = session.reportingService().newReportExecutionRequest(request); final ReportExecutionDescriptor reportExecutionDescriptor = operationResult.getEntity(); final OperationResult<ReportExecutionDescriptor> executionDetails = session.reportingService() .reportExecutionRequest(reportExecutionDescriptor.getRequestId()).executionDetails(); ReportExecutionDescriptor descriptor = executionDetails.getEntity(); if (descriptor.getStatus().equals("ready")) { // ***** new code ******* final ReportingService reportingService = session.reportingService(); final ReportExecutionRequestBuilder reportExecutionRequest = reportingService.reportExecutionRequest(descriptor.getRequestId()); final List<ExportDescriptor> exports = descriptor.getExports(); if (exports != null && exports.size() > 0) { final String exportId = exports.get(0).getId(); final ExportExecutionRequestBuilder export = reportExecutionRequest.export(exportId); final OperationResult<InputStream> AoperationResult = export.outputResource(); ...... if (generatedReport == null) { System.out.println("generatedReport is null !!!!"); } else { try { // final FileOutputStream reportOS = new FileOutputStream("C:\uoReport.pdf"); final FileOutputStream reportOS = new FileOutputStream("C:\testAgentswithAdapter3_XX.CSV"); int index; while ((index = (byte) generatedReport.read()) != -1) { reportOS.write(index); } reportOS.flush(); reportOS.close(); generatedReport.close(); ----------------------- my jrxml : <?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.0.4.final using JasperReports Library version 6.0.2 --> <!-- 2015-05-22T14:26:55 --> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="AgentsListeSansTemplate" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b0fa8b69-0e0e-49e9-b59d-bcbc510a7a08"> <property name="net.sf.jasperreports.data.adapter" value="repo:/Reports/service/testadapter1.xml"/> <property name="ireport.jasperserver.url" value="http://localhost:8888/jasperserver/"/> <property name="ireport.jasperserver.user" value="jasperadmin|STI"/> <property name="ireport.jasperserver.report.resource" value="/Reports/service/AgentsListeSansTemplate_files/main_jrxml"/> <property name="ireport.jasperserver.reportUnit" value="/Reports/service/AgentsListeSansTemplate"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="AgentsXML"/> <parameter name="XML_USERNAME" class="java.lang.String" isForPrompting="false"/> <parameter name="XML_PASSWORD" class="java.lang.String" isForPrompting="false"/> <parameter name="XML_URL" class="java.lang.String" isForPrompting="false"/> <queryString language="xPath"> <![CDATA[/ROWDATA/ROW]]> </queryString> <field name="DESCR_TYPE_AGENT_LANG1" class="java.lang.String"/> <field name="DESCR_STATUT_LANG1" class="java.lang.String"/> <field name="NO_EMP_FONCT_PUBLIC" class="java.lang.String"/> <field name="NO_SEC_SOCIAL" class="java.lang.String"/> <field name="HOMME_FEMME" class="java.lang.String"/> <field name="PRENOM_AGENT_LANG1" class="java.lang.String"/> <field name="NOM_AGENT_LANG1" class="java.lang.String"/> <background> <band splitType="Stretch"/> </background> <title> <band height="90" splitType="Stretch"> <staticText> <reportElement x="120" y="14" width="290" height="30" uuid="316cb0e7-17bc-4a43-a66f-e00ab69c5ab6"/> <textElement textAlignment="Center"> <font size="22" isBold="true"/> </textElement> <text><![CDATA[Liste des agents]]></text> </staticText> </band> </title> <pageHeader> <band height="58" splitType="Stretch"> <staticText> <reportElement x="170" y="8" width="39" height="30" uuid="c0485f79-e613-417b-a420-305c42a27f97"/> <text><![CDATA[H/F]]></text> </staticText> <staticText> <reportElement x="486" y="8" width="69" height="30" uuid="429194d2-833d-49b2-b652-dfd5d1e26b70"/> <text><![CDATA[TYPE_AGENT]]></text> </staticText> <staticText> <reportElement x="310" y="10" width="69" height="30" uuid="8e3709f4-bd5d-4d60-bcf4-b98add8fbb1e"/> <text><![CDATA[NO_EMP_FONCT_PUBLIC]]></text> </staticText> <staticText> <reportElement x="400" y="10" width="69" height="30" uuid="188ddc0e-1b15-4464-94ee-9f0e5320ca3f"/> <text><![CDATA[sTATUT]]></text> </staticText> <staticText> <reportElement x="220" y="10" width="69" height="30" uuid="1859c36b-17f5-4f59-b8ad-b7e95083ed96"/> <text><![CDATA[NO_SEC_SOCIAL]]></text> </staticText> <staticText> <reportElement x="90" y="10" width="69" height="30" uuid="ccee816b-d0da-4458-88e6-b801283c42e5"/> <text><![CDATA[PRENOM]]></text> </staticText> <staticText> <reportElement x="0" y="8" width="72" height="30" uuid="fe08e828-ecbf-45af-b025-2f5583e2fc07"/> <text><![CDATA[NOM]]></text> </staticText> </band> </pageHeader> <detail> <band height="37" splitType="Stretch"> <textField> <reportElement x="-1" y="0" width="72" height="30" uuid="7ab723f1-34f4-4ffd-99c8-524892641770"/> <textFieldExpression><![CDATA[$F{NOM_AGENT_LANG1}]]></textFieldExpression> </textField> <textField> <reportElement x="90" y="0" width="69" height="30" uuid="bfdffa2c-64f2-4627-b6e1-b5720fcd4526"/> <textFieldExpression><![CDATA[$F{PRENOM_AGENT_LANG1}]]></textFieldExpression> </textField> <textField> <reportElement x="164" y="2" width="50" height="30" uuid="a0b6de3b-5e6e-485f-a4a4-643c1bed50a3"/> <textFieldExpression><![CDATA[$F{HOMME_FEMME}]]></textFieldExpression> </textField> <textField> <reportElement x="310" y="2" width="69" height="30" uuid="552715de-feeb-4bb0-bf07-82776b439742"/> <textFieldExpression><![CDATA[$F{NO_EMP_FONCT_PUBLIC}]]></textFieldExpression> </textField> <textField> <reportElement x="400" y="0" width="69" height="30" uuid="b1c8c7b2-9618-4915-a6a1-15c06049f0cc"/> <textFieldExpression><![CDATA[$F{DESCR_STATUT_LANG1}]]></textFieldExpression> </textField> <textField> <reportElement x="485" y="0" width="69" height="30" uuid="26f7fc0e-4e54-4c88-8fcc-636fbf33a5cc"/> <textFieldExpression><![CDATA[$F{DESCR_TYPE_AGENT_LANG1}]]></textFieldExpression> </textField> <line> <reportElement x="-20" y="32" width="591" height="5" uuid="0e8e77a9-9b15-4045-ab76-b90b5013089b"/> </line> <textField> <reportElement x="220" y="0" width="90" height="30" uuid="b5baa03f-762b-482d-8e49-99d2cc65c8fa"/> <textFieldExpression><![CDATA[$F{NO_SEC_SOCIAL}]]></textFieldExpression> </textField> </band> </detail> </jasperReport>
  2. Hi evry one; I create a report to be ru on server withe rest web service. i create a data adapter (XML Document (remote) withe name "XMLSource") on JasperSoft Studio and when i test it it's succes but when I select "XMLSource" in forme Dataset and Query Dialog in Jaspersoft Studio as a data adapter for my report and i select xPath and click on Read Fields i get an error HTTP response code : 401. whene i publish report on server and i try to run it withe java rest client i get as error Report design not valide because it's not found fields. how i can get content of my xml data adapter in jasper editor ? i thik if i can get that in editior my report can be ru correctly on server. Anny edia ? somoen can help ?. thank you.
×
×
  • Create New...