on 05-25-2016 1:16 PM
Hi IDM Experts!
.
I have successfully been able to interface with a REST API using a version of Jannis' useful function.
Using this method, one can easily interface with a REST API, as long as its served via an HTTP connection (using the java class java.net.HttpURLConnection); however if the API is served via an HTTPS connection, the java class I assume in this case would have to be javax.net.ssl.HttpsURLConnection, but importing the HttpsURLConnection class in this manner:
importClass(Packages.javax.net.ssl.HttpsURLConnection);
still does not allow us to use the HttpsURLConnection class; how do we access an HTTPS URL / REST API, via javascript in IDM 8.0?
Would greatly appreciate your help / advice on this!
Thanks a ton in advance!
Best regards,
Sandeep
Hi Sandeep,
Which error message or return code do you get?
I guess that is the same question as how to connect to LDAPS with a directory. There, you have to import the certificate of the directory into the Java Runtime used by the Dispatcher.
I suggest importing the certificate of the Web Server into the Java Keystore and try again.
Cheers, Jannis
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jannis,
Thank you so much for your prompt reply! At this point I only get the following error:
"RuntimeException - undefined: "HttpsURLConnection" is not defined"
When trying to convert the existing openConnection into an HttpsURLConnection:
writeConn = new HttpsURLConnection(url.openConnection());
Based on this, it seems like the import statement (importClass(Packages.javax.net.ssl.HttpsURLConnection) itself isn't working as expected.
I also seem to get this error, further confirming that the import is not working as expected:
Mozilla.javascript.EvaluatorException: Function importClass must be called with a class; had "[JavaPackage javax.net.HttpsURLConnection]" instead.
How does one use the HttpsURLConnection class to access an HTTPS URL? Or is there another way to do this without using that class? Would importing the Web Server's certificate into the IDM Java Keystore and then accessing the HTTPS API via the normal HttpURLConnection method work as expected? or can this only be achieved using the HttpsURLConnection class?
Thanks a ton for your help Jannis!
Cheers,
Sandeep
Message was edited by: Sandeep J
Thanks again for your advice Jannis! I tried accessing the HTTPS API via the normal HttpUrlConnection method (without using any additional JAVA classes / libraries; i.e. javax.net.ssl.HttpsURLConnection), and it finally worked, AFTER importing the SSL certificate for the target API using the following command (from the IDM documentation:Exporting and Installing the SSL Certificate - SAP Identity Management Installation and Update Guide...😞
<JDK_PATH>\lib\security> keytool -import -alias <CERTIFCATE_SSL_ALIAS> -file <CERTIFICATE_PATH>\sample_certificate.cer -keystore cacerts
Based on this, there isn't any need for using any additional JAVA classes besides the already used java.net.HttpURLConnection.
Thanks a ton for your advice Jannis!
Cheers,
Sandeep
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.