Applies to ReadyAPI 2.8, last modified on August 16, 2019

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.

1. Create SSL Keystore

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:

  • Windows

    "C:\Program Files\Java\jdk8\bin\keytool" -genkeypair -alias readyapi -keyalg RSA -keystore "C:\My folder\readyapi-keys.jks"

  • Linux

    keytool -genkeypair -alias readyapi -keyalg RSA -keystore ./ready-api.jks

After you started keytool, answer some questions that are necessary for generating the keypair:

Service virtualization and API testing: Running keytool for generating SSL keystore

Click the image to enlarge it.

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:

2. Configure SSL Settings

After you generated the SSL keystore, you need to specify it in your virtual service settings:

  1. Select your service in the Navigator panel. Switch to the property editor on the right of the product window.

  2. In the Info section, select the https protocol, then click SSL Settings:

    Service virtualization and API testing: Configuring SSL properties of a virtual API

    Click the image to enlarge it.

  3. 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.

3. Change Test Requests

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:

Service virtualization and API testing: Changing protocol in test requests

Click the image to enlarge it.

Start the virtual service, send test requests and check responses.

See Also

Configuring Virtual Services
Using Custom SSL Certificates for VirtServer

Highlight search results