How to call web service with unknown certificate - web-services

I have generated client stub using wsdl2java.
I am able to call webservices of HTTP server.
But I have HTTPS server with self signed certificate.
When I called same service for HTTPS server, its throwing exception :
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
How to modify client stub to accept all certificates?

You have one of two options:
Trust the cert. One possible approach is this: http://www.mkyong.com/webservices/jax-ws/suncertpathbuilderexception-unable-to-find-valid-certification-path-to-requested-target/
Alternatively, choose to ignore the error and keep going. See this stackoverflow q: How to ignore PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException?
Google is your friend...

Related

SSLException when using pubsub and cloud SQL

I am trying to set up Cloud SQL in my project and hence to make it work I installed custom SSL certificates. However, now I cannot connect to PubSub and get this error
Caused by: 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
I am not sure how to get Cloud SQL to work along with PubSub. Any tips are welcome. Haven't been able to find anything on the internet yet

WSO2 Dashboard SAML auth: PKIX path building failed

Using the wso2 identity server in my on production site I try to access to "dashboard jaggery apps" for manage own user account (change password, etc). But when I try to login in there (using SAML2 in the https production domain) shows the following error,
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
We write the keystore path in the auth_config.json inside repository/deployment/server/jaggeryapps/dashboard/authentication, but it does not work.
We have other application using the same fingerprint and/or x.509 hash correctly (with SAML2), but this app we can't configure.
here the complete error http://pastebin.com/tgJenydM
Any suggestions? Thanks.
update:
When I use the backend IP the error is not raised, but when I change to the domain name yes. (This error really make me crazy)
Did you change the default keystore of WSO2IS server ? If, Could you pleas let us know whether you import your new certificate in to the trust store file (client-truststore.jks) of WSO2IS server. If it is not, This can be the issue. Please export the certificate from Keystore and import it in to the trust store of the server. You can use jave keytool command to do it.
When you are working on dashboard (not in localhost), there are some few configuration you need to do . You can find them from here

Unable to execute playground wso2 identity server oauth example

Whenever i click on GetPhotos, playground (oauth2.jsp) gives me this error:
javax.net.ssl.SSLException: 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 worked for me with IS-4.1.0, Tomcat-7.0.41, and the WAR file downloaded from:
https://svn.wso2.org/repos/wso2/scratch/Identity-Server-4.5.0/M6/samples/playground.war
See:
http://sureshatt.blogspot.com.es/2013/08/openid-connect-with-wso2-identity.html
It seems there are different Playground app versions out there, some are buggy or outdated.
Also you must make sure you enter the exact strings as OAuth2 Playground parameters (id, secret,...). It happened to me that even copy-pasting them within Firefox it didn't work, so make sure you trim those strings yourself.
Maybe the webapp you are running does not trust the keys from the identity server. See steps 9-10 on http://docs.wso2.org/display/IS450/WSO2+Identity+Server+as+an+OpenID+Provider

SSL Exception when WebService endpoint url has https

I am getting the below exception when I invoke a jax ws webservice from my application deployed in WebSphere Application Server 6.1
SSL HANDSHAKE FAILURE: A signer with SubjectDN "CN=yyy.com, OU=For Intranet Use Only, OU=Web Hosting, O=xx, L=xx, ST=xx, C=xx" was sent from target host:port "*:9445". The signer may need to be added to local trust store "F://../trust.p12" . The extended error message from the SSL handshake exception is: "No trusted certificate found".
The enpoint url has https.
With the same enpoint url I am able to get a response from SOAP UI(Tool) without any certificate configuration etc..
Could you help me on this ?
I finally was able to fix this small issue.The Server certificate needs to be added to the websphere appserver truststore.This can be done from the admin console of websphere by providing the server domain and port.

jaxws client get https wsdl errors

I am testing a web service hosted on https. I use jaxws for the connection.
This retrieves the wsdl first but that's where the error occurs. I saved the certificate in IE on my local machine and created a keystore from it, as described in JAX-WS-https-client and changed JVM arguments so that the keystore loads.
This did achieve that the url used to retrieve the wsdl contained protocol https instead of http, so things started to look better. But now I get the following error:
SystemException: PropagatedException: WSDLException: faultCode=OTHER_ERROR: Unable to resolve imported document at 'https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx?wsdl'.: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Does this mean that the certificate was copied to filesystem incorrectly?
Is something else wrong? What to do?
I should note that when exporting a certificate from IE, the option is given to export the private key or not. When not exporting the private key, then it can be saved as .cer file which is necessary for creating the keystore. On the other hand, when I try to export the private key, the file extension is .pfx and this cannot be converted to a keystore.
My bad - I had Fiddler running and thus used a certificate issued by Fiddler.
When I added the real certificate to the keystore, the webservice call was OK.