https requests using the http plugin

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

https requests using the http plugin

Postby aaron.greenhalgh » Thu Aug 17, 2017 3:58 pm

I am using plugins.http.createNewHttpClient() to consume a .NET Web API deployed on a server, unfortunately due to my companies security regulations everything must be certified (https).

I am using the following code to communicate with the site;

var client = plugins.http.createNewHttpClient();
var encodePlainURI= encodeURI(URI);
var getRequest = client.createGetRequest(encodePlainURI);
var getResponse = getRequest.executeRequest();
var getStatusCode = getResponse.getStatusCode();


If the URI is sent via HTTP then everything is good, status code is 200 'ok', but using HTTPS it just returns null.

I understand that this is down to java certificates and have followed the instructions in https://wiki.servoy.com/display/public/tutorials/Import+a+%28Root%29+certificate+in+the+java+cacerts+file to install them, still no luck.

The following is a text snippet from the Servoy http plugins manual ...

If this url is an https url that uses certificates unknown to Java
then you have to use the HttpClient so that smart client users will get the unknown certificate dialog that they then can accept
or you must make sure that those server certificates are stored in the cacerts of the java vm that is used (this is required for a web or headless client)


Now to me this indicates that the user can resolve this, as a dialog box will prompt them to authenticate, unfortunately this does not appear like it says it will.

I have already tried installing the certificates myself, but as already said above, no luck.

If anyone has step by step instructions for this it would be greatly appreciated, it's holding me back quite a bit and there's virtually no previous online support found anywhere.
aaron.greenhalgh
 
Posts: 1
Joined: Thu Aug 17, 2017 3:37 pm

Re: https requests using the http plugin

Postby jcompagner » Fri Aug 18, 2017 11:27 am

why is that https site not using a valid certificate where the root is also know to java ?

What client are we talking here about? Is that smart or a server based (web/ng/headless) client?

Because for a smart client you need to import that certificate in the java certificate stores over all your clients (which is to me a maintenance nightmare)
Currently we have so many easy ssl stuff like "Let's crypt" that for me it seems weird that you use a custom/self signed certificate.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 7974
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Programming with Servoy

Who is online

Users browsing this forum: No registered users and 2 guests