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

porozco

Members
  • Posts

    3
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by porozco

  1. Hi Everybody! According to Samples from: http://community.jaspersoft.com/wiki/php-client-sample-code 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.
  2. Thanks for your time Grant, Now I think We are going to stick to the Stable version from: http://community.jaspersoft.com/project/php-client/resources Great work man!
  3. Hello Everyone, Today I felt some curiosity about: https://github.com/Jaspersoft/jrs-rest-php-client Thats why I just cloned and set-up autoload.php to start testing this Client. Here is my code: <?php error_reporting(E_ALL);ini_set('display_errors', '1'); require_once __DIR__ . "/vendor/autoload.php"; use JaspersoftClientClient; $c = new Client( "report.myserver.com", "80", "username", "password", "/jasperserver-pro", "organization_1" ); //$info = $c->serverInfo();//print_r($info); $r = $c->repositoryService()->resourceSearch(); //print_r($repo); ?>But I am having a response with error: HTTP Status 401 - Full authentication is required to access this resource. I just double checked username, password and org, and everything seems right. So testing, for example with: curl -D- -u username:password -X GET http://report.myserver.com:80/jasperserver-pro/rest/resources http://report.myserver.com:80/jasperserver-pro/rest/resources?j_username=username&j_password=password Is responding right, with an XML response of resource descriptors. Another interesting thing I found debugging (var_dump) function setCurlOpts in RESTRequest.php is that $this->url is: http://report.myserver.com:80/jasperserver-pro/rest_v2/resources and not: http://report.myserver.com:80/jasperserver-pro/rest/resources which responds with a not found status. I also tried adding some Authorization: Basic to CURLOPT_HTTPHEADER. protected function setAuth (&$curlHandle){if ($this->username !== null && $this->password !== null){curl_setopt($curlHandle, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);curl_setopt($curlHandle, CURLOPT_USERPWD, $this->username . ':' . $this->password); curl_setopt($curlHandle, CURLOPT_HTTPHEADER, array("Authorization: Basic " . base64_encode($this->username . ":" . $this->password))); }}But no succesful response is back. By the way, Passing variables by reference is a deprecated issue to worry about? Even if my php 5.5.1-2 is not yelling about it. Thanks in advance.
×
×
  • Create New...