Come considerare valido un certificato SSL da un client Axis1
La situazione è questa:
- Dovete chiamare un webservice
- Siete obbligati ad usare Axis1
- Create le classi client e chiamate il webservice all’url che vi danno, che è:
https://giacomino:8443/services/DaiDaMangiareAlGatto
Salta subito all’occhio che il webservice che dovete chiamare è stato pubblicato in https, lo chiamate ed ottenete l’errore:
; nested exception is: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target |
Le soluzioni sono due. O vi fate dare il certificato e lo mettete nel vostro keystore, oppure ignorate l’errore. Se potete fatevi dare il certificato, ma se non potete, è sufficiente, prima della chiamata al webservice, impostare la proprietà axis.socketSecureFactory in questo modo:
System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory"); |
Fonte:
http://wiki.apache.org/ws/FrontPage/Axis/SslUnsignedCertificate
Leave a Reply