soapUI has been a wonderful tool for testing webservices. It can also generate MockServices which can be used for testing the client if you have the WSDL contract. This is a very quick way to get up and running. You can also add WS-Security to it. There is a very good tutorial on soapUI to for using SSL as well. I wanted to extend this to use 2 way SSL. I have keytool command-line utility for generating keystore and certificates.
On Serverkeytool -genkey -alias server -keyalg RSA -validity 3650 -keystore c:\server.keystore -storepass abcd1234 -keypass abcd1234keytool -export -alias server -keystore c:\server.keystore -storepass abcd1234 -file c:\server.cerkeytool -import -alias client -keystore c:\server.keystore -storepass abcd1234 -file c:\client.cer
Settings on the server prior to generating the mock service:-On Clientkeytool -genkey -alias client -keyalg RSA -validity 3650 -keystore c:\client.keystore -storepass abcd1234 -keypass abcd1234keytool -genkey -alias client -keyalg RSA -storetype PKCS12 -keystore c:\client.p12 -storepass abcd1234 -keypass abcd1234keytool -export -alias client -keystore c:\client.p12 -storetype PKCS12 -storepass abcd1234 -file c:\client.cerkeytool -import -alias server -keystore c:\client.keystore -storepass abcd1234 -file c:\server.cer
Settings on the client prior to generating the request:-
Once the request is sent and the correct response is obtained after decryption :-
Raw response on client side :-
Raw response on server side:-
NOTE: Generate the request and MockService AFTER saving the SSL preferences and restarting soapUI. It might not work if you do it the other way around. Also, make sure you use https as the endpoint on the client end.
If wrong password is entered in client you will get bad_certificate response and it will not decrypt the response on the client end :-Advertisements