Jump to content
JasperReports Library 7.0 is now available ×

tdavincci

Members
  • Posts

    3
  • Joined

  • Last visited

tdavincci's Achievements

Newbie

Newbie (1/14)

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

Recent Badges

0

Reputation

  1. Hello, These may come late but hope someone finds it helpful. I am assuming you are calling jasper report from some application which consumes data from a REST service which has a token based security. So you have to send login details to get the access TOKEN. I am suggesting from your application before calling the jasper report, you should send your login details and obtain your access token and probably store it for all subsequent requests. Then pass the TOKEN as a normal parameter to jasper report, and then inject the parameter in Request header when creating the Webservice Adapter. so that way the REST server can respond with corresponding data to populate your report as long as the Token is valid.
  2. Hello, These may come late but hope someone finds it helpful. I am assuming you are calling jasper report from some application which consumes data from a REST service which has a token based security. So you have to send login details to get the access TOKEN. I am suggesting from your application before calling the jasper report, you should send your login details and obtain your access token and probably store it for all subsequent requests. Then pass the TOKEN as a normal parameter to jasper report, and then use inject the parameter in Request header when creating the Webservice Adapter. so that way the REST server can respond with corresponding data to populate your report as long as the Token is valid.
  3. I once experianced difficulty with that, I have solved my problem in a different way. I used nusoap webservice as datasource for my project. That means I pass parameter to jasperserver then jasperserver will make a get request to a php page (or nusoap) where the parameters is used to get records from database. the record then returns in JSON format to jasperserver as datasource for the report. after understanding this, you realize there are three stageshere. 1. jasper studio 2.jasper server 3. php page (nusoap), acting as datasource. at stage 3. you shoult encode the image using "base64_encode()" /* just a dummy sample*/$sql = "SELECT name, image FROM ...";$result = $con>query($sql); /* create one master array of the records */$records=array();if ($result->num_rows > 0) {while($row = $result->fetch_assoc()) { $row['image']=base64_encode($row['image']); //encode Image $records[] = array('myRows'=>$row);}//header('Content-type: application/json');return json_encode(array('records'=>$records));[/code]then you echo back the result at stage no 1change the datatype for your image to string,on the image field use this expression to decode the image backnew java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($F{image}.getBytes()))[/code] One year pass. lol. hope its still going to be helpful to you or others
×
×
  • Create New...