bartlomiejkow
3 years agoNew Contributor
Change Signature Algorithm from groovy script
I trying to change the Signature Algorithm for Outgoing WS-Security Configurations from the groovy script.
Here is my code:
import com.eviware.soapui.support.XmlHolder
project = testRunner.testCase.testSuite.project
WssC = project.getWssContainer();
outWss = WssC.getOutgoingWssByName('outCrypto')
config = outWss.getConfig()
configSignature = config.getEntryList()[0].getConfiguration()
holder = new XmlHolder(configSignature)
holder.setNodeValue('signatureAlgorithm','http://www.w3.org/2001/04/xmldsig-more#rsa-sha256')
//holder.setNodeValue('signatureAlgorithm','http://www.w3.org/2000/09/xmldsig#rsa-sha1')
holder.updateProperty(true)
config.getEntryList()[0].setConfiguration(holder.getXmlObject())
config.set(config)
outWss.updateConfig(config)
WssC.resetConfig(WssC.getConfig())
After running the code, the signature does not change. In the WS-Security Configurations window still was an old algorithm, but when I save and reload the project the algorithm was changed according to what was in the script.
How to change the algorithm so that the change is immediate?