please give me a simple example

0

 

I tried to use the PHP extension following the "PHP Client - Sample Code" but without success...

I don't know java and I'm new in PHP.

Anyway... I found very intersting this tool.

I tried something besic but I failed. This is what I tried:

 


require_once "JasperClient.php";

$client = new Jasper\JasperClient('http://server_address', // Hostname
                8080, // Port
                'jasperadmin', // Username
                'jasperadmin', // Password
                '/jasperserver'); // Base URL

$report = $client->runReport('/reports/samples/AllAccounts', 'html');
echo $report;

 

and the error:

[Thu Jan 24 07:05:08 2013] [error] [client 188.27.149.158] PHP Fatal error:  Uncaught exception 'Jasper\\RESTRequestException' with message 'Unexpected HTTP code returned: 0' in /var/www/html/client/JasperClient.php:135\nStack trace:\n#0 /var/www/html/client/JasperClient.php(563): Jasper\\JasperClient->prepAndSend('http://127.0.0....', Array, 'GET', NULL, true)\n#1 /var/www/html/client/test.php(6): Jasper\\JasperClient->runReport('/reports/sample...', 'html')\n#2 {main}\n  thrown in /var/www/html/client/JasperClient.php on line 135

 

I found this site:

http://www.simit.com.my/?q=phpjasperxml

which has a very good idea about php integration but unfortunattly is outdated

I can't pass my parameters to my reports when I use theirs solution.

 

PS

Please correct the article sintax from "PHP Client - Sample Code" .. it's messy

ruscosmin's picture
Joined: Jan 24 2013 - 3:38am
Last seen: 6 years 8 months ago

2 Answers:

0

Based on the code snippet below (copied from above), it looks like you didn't specify a valid hostname. Is this actually the parameter list you supplied?

$client = new Jasper\JasperClient('http://server_address', // Hostname
                8080, // Port
                'jasperadmin', // Username
                'jasperadmin', // Password
                '/jasperserver'); // Base URL

 

jschiffman's picture
Joined: Jan 24 2013 - 11:20am
Last seen: 6 years 5 months ago
0

of course not... I used 127.0.0.1, localhost and the real IP ( I tried all combination from windows and linux, remote and local ) :D

jasper server was installed the following system:

OS: centos 6.2

Apache 2.0

# php -version
PHP 5.3.3 (cli) (built: Jul  3 2012 16:53:21)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

# pear install SOAP
pear/SOAP is already installed and is the same as the released version 0.13.0
install failed

# pear install Net_Dime
pear/Net_Dime is already installed and is the same as the released version 1.0.2
install failed

First I tried the sample app... but after I log in all that I see is an empty directorry:

List report

Current Directory: /
[..]




Exit

with the following log from httpd:

[Fri Jan 25 04:10:19 2013] [error] [client ..... ] PHP Notice:  Undefined index: uri in /var/www/html/php-sample/listReports.php on line 15
[Fri Jan 25 04:10:19 2013] [error] [client ..... ] PHP Warning:  DOMDocument::loadXML(): Start tag expected, '  

Maybe I missed some configurations... Also, I tried on windows with XAMPP but it give me tons of errors and warnings.

Any sugestions?


 

 

 

ruscosmin's picture
Joined: Jan 24 2013 - 3:38am
Last seen: 6 years 8 months ago
Feedback
randomness