Using remote jasper server visualize API

Hi,

Most of the examples I saw under visualize.js are using localhost. I do not have jasperserver installed on local, so I am trying to connect to remote server to create sample html using visualize.js. But I am not able to see the report on html and getting below error.

TypeError: t is null
Line 64

Here is simple html:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test Visualize</title>
 
</head>
<body>
<h2>Simple Visualize.js</h2>
<div id="container"></div>
<script type="text/javascript" src="http://myremoteserver:8080/reportservice/client/visualize.js"></script>
<script type="text/javascript">
visualize(
    {
        auth:{
        name:"admin",
        password:"admin",
organization:"test"
        }
    },function (v){
//render report from provided resource
    v("#container").report({
        resource: "/organizations/test/temp/MyReport",
        error: handleError
    });
    //show error
    function handleError(err) {
        alert(err.message);
    }
});
</script>
</body>
</html>
 
I am wondering if remote server is supported or not. If not how can I create simple html and test report with visualize.js ?
 
Thanks
aksharaloni's picture
Joined: Sep 13 2015 - 10:34pm
Last seen: 7 years 4 months ago

2 Answers:

Remote servers are supported because I'm using it in one of my site.

I just tested it on a local server and replaced the server ip address afterward.

There may be a firewall preventing access.

1. Check if visualize.js file on the remote server can be opened from the web browser.

2. Check if the report can be accessed using REST v2 API.

hozawa's picture
170493
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago

Thanks for your inputs. To answer your question

1. Yes, I can access visualize.js from the browser

2. Not sure how to check if report is access through rest api. Can you help me with this ?

Thanks.

 

 

aksharaloni's picture
Joined: Sep 13 2015 - 10:34pm
Last seen: 7 years 4 months ago
Feedback