Jump to content
Changes to the Jaspersoft community edition download ×

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


porozco

Recommended Posts

Hi Everybody!

 

According to Samples from:

 


 

Yesterday I felt a little bit curious about testing Jasper Client, so I started using following code:

 

<?php

 

require_once "rest/client/JasperClient.php";

 

$client = new JasperJasperClient('report.myserver.com',

                 80,

                'myuser',

                'mypassword',

                '/jasperserver-pro',

                'organization_1');

 

 

$repository = $client->getRepository();

 

var_dump($repository);

 

?>

 

But the Apache Error Log is yelling me with an error like this one:

 

[Thu Sep 19 10:14:29 2013] [error] [client 127.0.0.1] PHP Fatal error:  Uncaught exception 'Jasper\RESTRequestException' with message 'Unexpected HTTP code returned: 401 Body of response: Apache Tomcat/7.0.40 - Error report HTTP Status 401 - Full authentication is required to access this resourcetype Status reportmessage Full authentication is required to access this resourcedescription This request requires HTTP authentication.Apache Tomcat/7.0.40' in /var/www/jasperreports/htdocs/rest/client/JasperClient.php:133nStack trace:n#0 /var/www/jasperreports/htdocs/rest/client/JasperClient.php(587): Jasper\JasperClient->prepAndSend('http://report.s...', Array, 'GET', NULL, true)n#1 /var/www/jasperreports/htdocs/info.php(13): Jasper\JasperClient->getRepository()n#2 {main}n  thrown in /var/www/jasperreports/htdocs/rest/client/JasperClient.php on line 133

 

I just double checked host, username, password and org and everything seems right.

 

Do I am missing something here?

 

Thanks in advance.

 

Link to comment
Share on other sites

  • 2 months later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Hello!

I'm trying to do something like this:

<?PHPini_set('display_errors',1);ini_set('display_startup_errors',1);error_reporting(E_ALL);require_once "vendor/autoload.php";use JaspersoftClientClient;$c = new Client(        "localhost",        "8082",        "jasperadmin",        "jasperadmin",        "/jasperserver",        "organization_1"      );$info = $c->serverInfo();print_r($info);?>[/code]

i have a similar error:

Fatal error: Uncaught exception 'JaspersoftExceptionRESTRequestException' 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 /home/lucas/projects/integracao/vendor/jaspersoft/rest-client/src/Jaspersoft/Tool/RESTRequest.php:431 Stack trace: #0 /home/lucas/projects/integracao/vendor/jaspersoft/rest-client/src/Jaspersoft/Service/JobService.php(86): JaspersoftToolRESTRequest->prepAndSend('http://localhos...', Array, 'GET', NULL, true, 'application/job...', 'application/job...') #1 /home/lucas/projects/integracao/index.php(20): JaspersoftServiceJobService->getJob('/reports/listae...') #2 {main} thrown in /home/lucas/projects/integracao/vendor/jaspersoft/rest-client/src/Jaspersoft/Tool/RESTRequest.php on line 431

Anyone know how to fix it?

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...