Accessing a secured Web Service from Java
Step 1: Ensure that you can access the WSDL on the remote server
https://localhost:9443/services/AuthenticationAdmin?wsdl
Step 2: Download the server certificate and save it in a file
Server name and port are important in the command line below.
openssl s_client -connect 127.0.0.1:9443
From the resulting output copy the part from BEGIN CERTIFICATE all the wat to END CERTIFICATE (inclusive of the first and last line) and save it in a text file. Let's call this file myServer-cert.txt
Step 3: Import the cert into the Java's JVM Keystore
Assuming JAVA_HOME variable is set, do the following on a Apple Mac
sudo $JAVA_HOME/bin/keytool -import -trustcacerts -alias wso2-localhost -file ~/LD/skyshelf/wso2-id-server.localhost.cert -keystore $JAVA_HOME/lib/security/cacerts -storepass changeit -noprompt
In other OS the location of the JVM keystore is different, so change it appropriately
Step 4: Re-run your application
0 Comments:
Post a Comment
<< Home