SSL certificate issue in web service proxy

I am creating a JAVA client web service in which I connect to the service.

This service has ssl certificate confirmation.

How to call this service using ssl certificate verification.

I am using the JAX-RPC implementation in a client built using Eclipse.

An example might be appriciated.

0
source share
3 answers

I can connect to the web service ...

I added a keystore using the command:

keytool -import -trustcacerts -file <file path/filename.cer> -alias <aliasName> -keystore <JAVA_HOME/jre/lib/security/cacerts> 

gave the password as "changeit" and added the certificate to the keystore.

Now in the code I added two lines:

 System.setProperty("javax.net.ssl.trustStore", "<JAVA_HOME>/jre/lib/security/cacerts"); System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); 

also added

 _call.setUsername("username"); _call.setPassword("password"); 

where _call is the call class call object.

And it worked !!!!!!

+1
source

All you have to do is enter the server root certificate into the JDK / JRE environment using the following command line: -

 keytool -importcerts -trustcacerts -file <path_to_root_cer_file> -alias <the_server_alias> -keystore <your_keystore> 

By default [your_keystore] is

  1. <JDK_HOME>/jre/lib/security/cacerts 2. <JRE_HOME>/lib/security/cacerts 

The default password is changeit.

When you call the web service, just specify

 "https://<host>:<SSL_port>/Path/To/Services" 

Hope this helps you achieve your requirements.

Hello,

Charlee ch.

0
source

Do you mean that your web service is protected by a "client certificate"? If so, get a .p12 (PFX) certificate or key store from your service provider and use the following system properties to set it before your call:

javax.net.ssl.keyStore - path to the keystore on your server

javax.net.ssl.keyStorePassword - passphrase for this keystore

javax.net.ssl.keyStoreType . Install it in "pkcs12", the client certificate provided to you .p12

If the application is a client of only one web service provider, set these properties as arguments to the virtual machine; if not, you may need to create a specific SSLConnectionFactory for each secure endpoint. See my answer to this post for details on creating your own SSL sockets.

0
source

All Articles