Hi,
I am using a webservice for authorizing credit card details.
The url for this is suppose:
https://test.otherwebsite.com?userid=11&pwd=535 Now this will generate some response headers and I want to parse them to know whether transaction has been successful.So I wrote code:
code:
--------------------------------------------------------------------------------
URL url = new URL("https://test.otherwebsite.com?userid=11&pwd=535"); HttpsURLConnection huc = (HttpsURLConnection) url.openConnection(); huc.connect(); InputStream is = huc.getInputStream(); out.println("code:"+huc.getResponseCode()); huc.disconnect();
--------------------------------------------------------------------------------
I am using jboss server.
Now I get an error:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.secrtpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Can anyone tell how can I resolve this error.Also ,when I directly copy and paste this link on browser then I am able to see the headers with no error.
Thanks.
Hi,
The problem you face is that the server gives a certificate which you were not able to verify with the CA certs available on your CAcerts keystore.Which is usually in "jre/lib/security/cacerts" import the certificate that was sent by your server to this keystore.