How to set the keystore file and password programmatically on WsdlTestStep?
Hi there,
We are leveraging the SoapUI test (v2.5) as a smoke test suite, and get to a stage that we can invoke the test step programmatically. However, we are stuck at the stage that the communication does not send any client certificate (verified by inspecting the SSL communication handshake traffic in debug mode; our web service interaction requires mutual authentication). To get the ssl cert config in, we tried setting it on the Java system variable or on the SoupUI Project xml through the for the keystore & for the password. However the SoapUI API still seemed to ignore it. We also tried the setSslKeystore() method on WsdlRequest but the same failure result. Another question here is that it is unclear which method is for setting the keystore password. There is a setPassword() method at the authentication level. We just used it.
The interesting thing is that when we run the test case on the UI using the green arrow (i.e. submit request to the end point), it worked fine with the keystore configuration on SSL setings in the global preference. Launch the TestRunner through the UI also returned the same failure result due to SSL cert not being sent.
// Approach 1 - Failed - No SSL Cert sent List wsdlInterfaces = (List)wsdlTestStep.getRequiredInterfaces(); if (wsdlInterfaces.size() > 0) { WsdlInterface wsdlInterface = (WsdlInterface)wsdlInterfaces.get(0); WsdlOperation wsdlOperation = wsdlInterface.getOperationByName("GetXX"); WsdlRequest wsdlRequest = wsdlOperation.getRequestByName("GetXXRequest"); wsdlRequest.setSslKeystore(keystore); wsdlRequest.setPassword("xxx"); wsdlRequest.submit(new WsdlTestRunContext(wsdlTestStep),false);
}
// Approach 2 - Failed - No SSL Cert sent // SSL Cert path in the project xml file WsdlTestCaseRunner wsdlTestCaseRunner = wsdlTestCase.run(new StringToObjectMap(), false);
2) Add a Keystore to the WSS Settings in your project (in the project window, WS-Security tab) and then specify that keystores' name for the SslKeystore property on the testrequest in your testcase (not the standalon wsdlrequest);