Announcement

Migration of this forum

Dear users of this forum,

we are pleased to inform you that we will be updating the software behind this forum in the near future.

Existing posts, users and categories will remain untouched.

Important:

  • Each user will need to reset their password.
  • Please select "I forgot my password".
  • Enter the email address you used to register in this forum.
  • You will receive an email with a link to set a new password.
  • Please choose a new (secure) password and confirm the process.

We will keep you informed in the pinned thread.

Kind regards,
Your ReportServer Team


Migration des Forums

Liebe Nutzer dieses Forums,

wir freuen uns, euch mitteilen zu können, dass wir in naher Zukunft die Software hinter diesem Forum aktualisieren werden.

Existierende Beiträge, Nutzer und Kategorien bleiben weiterhin bestehen!

Wichtig:

  • Jeder Nutzer muss sein Passwort neu vergeben.
  • Wählt dazu einfach "Ich habe mein Passwort vergessen".
  • Gebt die E-Mail-Adresse ein, mit der ihr registriert seid.
  • Ihr erhaltet eine E-Mail mit einem Link zur Passwortvergabe.
  • Bitte wählt ein neues (sicheres) Passwort und bestätigt den Vorgang.

Wir halten euch im angepinnten Beitrag auf dem Laufenden!

Mit vielen Grüßen
Euer ReportServer Team

#1 2021-04-14 08:24:04

Stéphane
Member
Registered: 2020-09-30

Scripting datasource for a rest api

Hello,

I'd like that a datasource uses a rest api.

First, i create a script to use the rest api but there is already a problem:

def connection = new URL( "https://[NUXEO]/nuxeo/site/api/v1/query?query=" +
        URLEncoder.encode(
                "SELECT * FROM Document", 'UTF-8' ) )
        .openConnection() as HttpURLConnection

// set some headers
//connection.setRequestProperty( 'User-Agent', 'groovy-2.4.4' )
//connection.setRequestProperty( 'Accept', 'application/json' )

// get the response code - automatically sends the request
println connection.getInputStream()

I obtain this result

Script execution failed.
error message: javax.script.ScriptException: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) (java.net.SocketException)
script arguments:
file: CartoNuxeoScript.groovy (id: 576037, line 35)
line number: 35 (25)

How can we use REST API ?

Thanks

Offline

#2 2021-04-14 11:45:36

IF_Eduardo
Administrator
Registered: 2016-11-01
Website

Re: Scripting datasource for a rest api

Hi Stéphane,

this seems to be a java >= 9 issue, pls check here:
https://reportserver.net/en/tutorials/i … -practice/

If you use Java 9 or newer, you need some extra configuration which can be done in the setenv.sh of your Tomcat environment. Specifically, the following configuration is needed:

--add-opens=java.base/java.net=ALL-UNNAMED
--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED
-Djavax.net.ssl.trustStoreType=JKS

In particular, adding -Djavax.net.ssl.trustStoreType=JKS should solve your problem. But we recommend adding the other options as well.

For windows, you can find the guide here: https://reportserver.net/en/tutorials/i … n-windows/

Regards,
Eduardo

Offline

#3 2021-04-14 11:50:23

IF_Eduardo
Administrator
Registered: 2016-11-01
Website

Re: Scripting datasource for a rest api

Hi Stéphane,

this seems to be related if you need more information:
https://github.com/jruby/jruby/issues/5808
https://bugs.openjdk.java.net/browse/JDK-8194702

Regards,
Eduardo

Offline

#4 2021-05-04 11:57:18

Stéphane
Member
Registered: 2020-09-30

Re: Scripting datasource for a rest api

Hi Eduardo,

Very well, it's ok with the args you give

Thanks

Offline

Board footer

Powered by FluxBB