Forum Discussion

arutz's avatar
arutz
New Contributor
10 years ago
Solved

changing preferences from groovy script / "connection failed"-assertion

Hello everyone,   I am having trouble with setting up the certificate / store that is used when sending a SOAP-Request to a HTTPS endpoint that requires SSL-client authentification. I have no probl...
  • arutz's avatar
    10 years ago

    Just for those with a similar problem:

    • Changing the SSL-Config via Groovy-Script:
    import com.eviware.soapui.settings.SSLSettings
    import com.eviware.soapui.SoapUI
    SoapUI.settings.setString( SSLSettings.KEYSTORE, keystore_location )
    SoapUI.settings.setString( SSLSettings.KEYSTORE_PASSWORD, keystore_password )
    •  Asserting the connection fails with a SSL Handshake Exception (also via Groovy-Script):
    try {
        def connection_fails = this.context.getCurrentStep();
        def retrieval = connection_fails.getTestCase().getTestStepByName("test_step_that_should_fail");
        def com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStepResult runner = retrieval.run(testRunner,context);
        log.info(runner.getStatus())
        assert(!runner.hasResponse() && runner.messages[0].indexOf("SSLHandshakeException",0) != -1)
    } catch (Exception e) {
    	log.info(e)
    	log.error("error: ", e)
    }