我需要设置证书的相关链接。但在WS-Security配置 - 密钥库中,我只能设置绝对路径。我如何使用脚本执行此操作?
答案 0 :(得分:0)
import com.eviware.soapui.settings.SSLSettings
import com.eviware.soapui.SoapUI
// set
SoapUI.settings.setString( SSLSettings.KEYSTORE, pathToKeystore )
SoapUI.settings.setString( SSLSettings.KEYSTORE_PASSWORD, keystorePassword )
// get
SoapUI.settings.getString( SSLSettings.KEYSTORE, "value to return if there is no such setting set" )
https://www.soapui.org/scripting-properties/tips-tricks.html
答案 1 :(得分:0)
import com.eviware.soapui.impl.wsdl.support.wss.crypto.CryptoType
// 1. Specify the path to your keystore
def keystorePath = "C:\\pathToKeystore\\your_keystore.jks"
// To use a relative path
//def keystorePath = context.expand('${projectDir}') + "\\report\\your_keystore.jks"
// 2. Add a keystore
testRunner.testCase.testSuite.project.wssContainer.addCrypto(keystorePath,"keystore_password",CryptoType.KEYSTORE) //path, password, cryptoType
// 3. Get the status in the log
log.info(testRunner.testCase.testSuite.project.wssContainer.getCryptoByName("your_keystore.jks").getStatus()) // specify the name of your keystore
此代码根据您的要求运行。