|
FOROS PROFESIONALES WINDEV, WEBDEV y WINDEV Mobile |
| | | | | |
| Appel de webservice en Https |
| Iniciado por zechatdoc, 15,nov. 2018 09:00 - 1 respuesta |
| |
| | | |
|
| |
| Publicado el 15,noviembre 2018 - 09:00 |
Bonjour,
Je consomme depuis mon appli windev des webservices qui sont passés en https, avec certificat autosigné. (via soapExecute avec des xmls construits à la main) Du coup maintenant, impossible de les appeler, chaque fois je me prends le message :
"Alerte de sécurité : le certificat de ce site n'a pas été émis par une société reconnue ou à laquelle vous avez choisi de faire confiance"
On m'a dit qu'il fallait utiliser du coup un TrustManager qui accepte les certificats autosignés.. exemple de code en java :
protected void initClientWebServiceHTTPS() throws Exception { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; }
@Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { // TODO Auto-generated method stub }
@Override public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { // TODO Auto-generated method stub } } };
// Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { return true; } };
// Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
URL url = new URL("https://" + WSTechnique.getServeurHttpHostName() + ":" + WSTechnique.getServeurHttpPort() + "/WebServiceCompta?wsdl"); HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setHostnameVerifier(allHostsValid); // then initiate the service
this.webServiceComptaMTOM = new InterfaceWSComptaMTOMImplService( new URL("https://" + WSTechnique.getServeurHttpHostName() + ":" + WSTechnique.getServeurHttpPort() + "/WebServiceCompta?wsdl"), new QName("http://magnus.egf.webservicecompta", "InterfaceWSComptaMTOMImplService"));
final HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver(); this.webServiceComptaMTOM.setHandlerResolver(handlerResolver); }
Mais euuh... y'a-t'il moyen d'arriver au meme résultat depuis une appli windev ?  |
| |
| |
| | | |
|
| | |
| |
Miembro registrado 22 mensajes |
|
| Publicado el 15,noviembre 2018 - 09:20 |
Ignorer le certificat avec ..IgnoreErreur=httpIgnoreCertificatInvalide ?
-- Tous nos logiciels sur https://www.jsoft.fr/ |
| |
| |
| | | |
|
| | | | |
| | |
| | |
| |
|
|
|