By default, virtual services work through unsecured connections (the HTTP protocol). You may want your service to work through HTTPS to test how clients work over secured connections (SSL).
To do this, you need:
A keystore with SSL keys.
Configure the Protocol settings of your virtual service.
To use SSL, you need a keystore with private and public keys. If you do not have it, you need to generate it. The easiest way to do this is, perhaps, to use keytool – a command-line utility included in Java. Possible alternatives include Portecle or other tools.
Use a command line like this:
"C:\Program Files\Java\jdk8\bin\keytool" -genkeypair -alias readyapi -keyalg RSA -keystore "C:\My folder\readyapi-keys.jks"
keytool -genkeypair -alias readyapi -keyalg RSA -keystore ./ready-api.jks
After you started keytool, answer some questions that are necessary for generating the keypair:
In our example, we used the following parameters:
-genkeypair commands the tool to create a keystore.
-alias sets the name of the generated keypair.
-keyalg specifies the encryption algorithm to be used.
-keystore specifies the file name of the generated keystore.
For complete information on the command-line arguments, see keytool documentation on the Oracle website:
After you generated the SSL keystore, you need to specify it in your virtual service settings:
Select your service in the Navigator panel. Switch to the property editor on the right of the product window.
In the Info section, select the https protocol, then click SSL Settings:
In the subsequent Preferences dialog, configure the SSL settings.
|Note:||The settings apply to ReadyAPI, they are not specific to your project or virtual service.|
Select the Enable virtual service SSL check box to enable virtual APIs work through HTTPS.
Enter an available port number in the Virtual service port edit box. This port will be used for SSL access to virtual APIs.
|To work with HTTPS services, you should use this port, the service’s Port setting is ignored.|
In the Virtual service KeyStore box, specify the keystore file name.
In the Virtual service password field, enter the keystore password (not the keypair password).
In the Virtual service key password box, enter the keypair password.
Clear the Client Authorization check box.
Save the changes.
After you configured your virtual service properties and set SSL parameters, you need to update requests in your SoapUI tests or client code: in each request that you send to the service, replace the http protocol with https:
Start the virtual service, send test requests and check responses.