Giter Site home page Giter Site logo

jasperserver-for-php's Introduction

JasperServer REST Integration Sample

Code: http://github.com/marianol/JasperServer-for-PHP/

Author: Mariano Luna

Version: 2.0.1

Requirements

  • PHP version 5.3.x
  • JasperServer 4.7 or better installed in the same domian. (Tested with v 5.0.1)
  • The PEAR package manager (http://pear.php.net)
  • Embed theme installed on JasperServer (included in "./JasperServer Resources/JS-embed-theme") for version 4.7+ use embed-4.7.zip
  • For the interactive account report (writeback sample) you will need to import ./JasperServer Resources/AccountEditReport-JRSExport.zip into your JRS repository

Using thiis Sample

Once running, go to your web server and login to the sample using a valid Jasper Server username and password (i.e. jasperadmin/jasperadmin)

  • For samples using the REST API check the "Web Services Integration" tab
  • For samples using iFrames and full UI integration check the "Jasper UI Integration" tab
  • For documentation on the JasperServer PHP REST API wrapper class go to the "JasperReports Wrapper Docs" tab

Instalation Instructions

Quick Overview

  • Uncompress this folder into a path accessible to your Webserver
  • Set the Webserver Document Root: "./web_root"
  • Add "./resources/" to the include path of your PHP.ini
  • Modify "./resources/config.php" to match your JS and App instalation paths and URLs
  • For the SSO integration implemented in this sample to work, Jasper and this sample must be in the same domain

Instalation Step by Step How-To

This instructions assume that you already have JasperServer installed and a working Apache Web Server with PHP support. Uncompress the sample source ZIP file in your drive:

<myfolder>/php-sample-app/

Inside that folder you will find 2 folders:

./resources -> libraries and other resources
./web-root  -> application 
  1. Configure your Apache web server to add an alias to the Application web-root folder. We will make an alias to our application web root folder, this will put our application in:

    http:///myphpapp

Find the httpd.conf (apache configuration file) and add the following:

...
# Alias for PHP APP demo
Alias /myphpapp "<myfolder>/php-sample-app/web_root/"
<Directory "<myfolder>/php-sample-app/web_root/">
    Options Indexes  FollowSymLinks MultiViews ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
...

Change the path slashes accordingly depending on the OS that apache is installed on (windows or unix-like), check the Apache manual.

  1. Modify the .htaccess file in web-root, to change the PHP include path, if you want this change can also be made server-wide in PHP.ini
  • Edit the file called htaccess-sample that is in web-root there is only one line in this file should look like this:

    php_value include_path "\php-sample-app\resources;myPEARinstallfolder;."

myPEARinstallfolder is your path to php-pear installation folder, this may be in a different path check your php.ini file

  • SAVE this file as ".htaccess" (IMPORTANT! : note the . (dot) at the beginning of the file name.)
  1. Restart apache

  2. Configure the sample application. Change the paths inside ./resources/config.php

    ... // this should match the settings on your httpd.conf file // i.e. your application lives in http://localhost/myphpapp define('WWW_ROOT', '/myphpapp/'); // real OS path where the application is installed define('SITE_PATH', '/Library/WebServer/Documents/JSDemo/'); ... // CHANGE THIS TO POINT TO YOUR JASPER SERVER define('JRS_HOST', 'localhost'); define('JRS_PORT', '8080'); define('JRS_BASE', '/jasperserver-pro'); ...

  3. go to: http://localhost/myphpapp and Voila!

The RESTclient.php file has the input control rendering functions and all the meat is in:

- login.php (authentication)
- repository.php (repository browser)
- viewReport.php and executeReport.php (view and execute report)
- iframe.php (iframe UI integration)

External Libraries Used

All the external libraries are included in this sample, check each library folder or website for each individual license.

LICENSE AND COPYRIGHT NOTIFICATION

Copyright (C) 2005 - 2012 Jaspersoft Corporation - All rights reserved.

Unless you have purchased a commercial license agreement from Jaspersoft, the following license terms apply:

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

jasperserver-for-php's People

Contributors

marianol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jasperserver-for-php's Issues

please guide me properly in order to configure it

Dear how to set this. and what this path/folders belongs to as below. "JSDemo"
define('SITE_PATH', '/Library/WebServer/Documents/JSDemo/');

moreover how to set this in .htaccess
php_value include_path "/Library/WebServer/Documents/JSDemo/resources/:/usr/lib/php/pear/:."

please get me out this for running the smooth application demo and proper integration with the jasper server.
thanks

authentication

Hi Marianol,

I don't think that my issue is related to your project but I'm unable to authenticate to mine jasperserver via REST webservice. It return me always 401 unauthenticated.

Do you know if there is something to enable? I'm using a remote host to connect to jasperserver and using the same credentials that I'm using in its web interface.

this is the error in your app:
Unauthorized Exception: HTTP/1.1 401 Unauthorized Server: Apache-Coyote/1.1 P3P: CP="ALL" Content-Length: 12 Date: Wed, 09 Jul 2014 06:17:10 GMT Unauthorized

but I have the same if I can simulate via:
$ wget -O - "http://10.0.2.36:8080/jasperserver/rest/login?j_username=jasperadmin&j_pasword=jasperadmin"
--2014-07-09 08:28:28-- http://10.0.2.36:8080/jasperserver/rest/login?j_username=jasperadmin&j_pasword=jasperadmin
Connecting to 10.0.2.36:8080... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.

have you ideas?

Thanks!

Matteo

Authentication

I have been trying for days with various settings and I simply can't get logged in. I can login directly to the jasper server, but these PHP for jasperserver never seem to work.

Fatal error: Uncaught exception 'Jasper\RESTRequestException' with message in JasperClient.php on line 133

I get this message to the Repository Browsing the Web Services Integration section:

Repository »Reports» Samples

"By clicking 'samples', it generates the error"

In Apache log:

Fatal error: Uncaught exception 'Jasper\RESTRequestException' with message in JasperClient.php on line 133


In jboss log I get the message:

16:19:48,552 ERROR [com.jaspersoft.jasperserver.jaxrs.common.GenericExceptionMapper](http - 127.0.0.1-8080-1) Unexpected Error Occurs: com.sun.jersey.api.NotFoundExcept
ion: null for uri: http://localhost:8080/jasperserver/rest_v2/reports/reports/samples/AllAccounts/options?

Unauthorized error when trying to use this

Hi,

I have this error when I try to use the web apps bundled in this.

Unauthorized Exception: HTTP/1.1 401 Unauthorized Server: Apache-Coyote/1.1 P3P: CP="ALL" Content-Length: 12 Date: Mon, 15 Dec 2014 09:15:29 GMT Unauthorized

Can I know what is this? I follow the guides and just changed a bit that I don't think will hurt.

Rest v2 html images / charts are not showing up

Hi Mariano!

It has been a while, how are you doing?

I was trying out the new stuff using the rest_v2, and the images are coming back from the jasperserver looking like: /jasperserver-pro/rest_v2/reportExecutions/1448340476_1378856082848_7957/exports/html/attachments/img_0_0_55

I added a simple string replace to make them look like this, https://<server>:<port>/jasperserver-pro/rest_v2/reportExecutions/1448340476_1378856082848_7957/exports/html/attachments/img_0_0_55 but still no luck, resource not found.

Here is our version information

Product Edition: Enterprise
Features: Fusion AHD EXP DB AUD ANA MT
Product Version: 5.2.0
Build: 20130626_1922
License Type: Commercial
Expiration: 2014-06-28 16:59:00

Am I doing something wrong or maybe I need to go and re-request those from the server? Thanks so much for any help.

Fatal error: Uncaught exception 'Jasper\RESTRequestException' with message 'Unexpected HTTP code returned: 401 Body of response

Hello Marianol,
Thanks for sharing this great application. I am using it but got the following error when I clicks on the Web Services Integration link.
Can you please help me to solve this issue ?

Fatal error: Uncaught exception 'Jasper\RESTRequestException' with message 'Unexpected HTTP code returned: 401 Body of response: Apache Tomcat/7.0.42 - Error report HTTP Status 401 - Bad credentialstype Status reportmessage Bad credentialsdescription This request requires HTTP authentication.Apache Tomcat/7.0.42' in /var/www/php-sample-app/resources/jasper-rest/client/JasperClient.php:133 Stack trace: #0 /var/www/php-sample-app/resources/jasper-rest/client/JasperClient.php(587): Jasper\JasperClient->prepAndSend('http://localhos...', Array, 'PUT', NULL, true) #1 /var/www/php-sample-app/web_root/repository.php(56): Jasper\JasperClient->getRepository('/') #2 {main} thrown in /var/www/php-sample-app/resources/jasper-rest/client/JasperClient.php on line 133

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.