mardi 14 avril 2015

Unnable to consume Webservice behind apache over HTTPS with Java

Good morning. I'm exposing a webservice on jboss behind apache using HTTPS. I can access the wsdl without a problem via browser. When I test the webservice using SoapUI everything works fine. But when I generate a java client (using Axis2) and try to consume the webservice, I get the following exception:



Exception in thread "main" [INFO] Unable to sendViaPost to url[http://ift.tt/1DeZ9P7: Connection has been shutdown: 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


It is known apache redirects http requests to https. So I manually change client url to http, and test it. In this case the exception is the following:



[INFO] Unable to sendViaPost to url[http://ift.tt/1H3Svhm] org.apache.axis2.AxisFault: Transport error: 302 Error: Found


Why does it work on SoapUI, but not on my client?


I have been pointed I need to import the certificate into java cacerts with keytool, so I downloaded the public certificate and ran the following command:



"D:\Program Files\Java\jre7\bin\keytool.exe" -keystore "D:\Program Files\Java\jre7\lib\security\cacerts" -import -file "C:\Users\Jhonatas\Desktop\certificado\server.cer" -alias ws_vipid


Even after this I keep getting the same exceptions. Am I missing something? What else could I do to solve this? Thank you for any help!





Aucun commentaire:

Enregistrer un commentaire