simonjd
11 years agoNew Contributor
Setting Parts for WS-Security
I am current writing some Groovy that will allow OWSM security settings to be configured quickly for future testing.
I have got into some difficulty when attempting to add Parts to the Parts table. To see what I am talking about, on Soap UI:
- Double click a Project
- Select the WS-Security Configurations tab
- Select the Outgoing WS-Security Configurations tab
- Add a New Configuration + Give it a name
- Add a new WSS Entry (Signature)
- See the Parts table.
Currently I am using the following code to try and populate this table:
--------------------------------------------------------------------------------------------------------
package com.eviware.soapui.impl.wsdl.support.wss.crypto;
import com.eviware.soapui.support.types.StringToStringMap;
def coredb = testRunner.testCase.testSuite.project.getWssContainer()
def outgoing = coredb.getOutgoingWssByName("Outgoing")
def signature = outgoing.addEntry("Signature")
List<StringToStringMap> list = new ArrayList<StringToStringMap>()
StringToStringMap parts = new StringToStringMap()
parts.put("ID", "")
parts.put("Name", "Timestamp")
parts.put("Namespace", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
parts.put("Encode", "Element")
list.add(parts)
signature.setParts(list)
------------------------------------------------------------------------------------------------
However, this seems to populate a blank row in the Parts table without the content I have specified.
Is this due to some mapping that I am missing? Has anyone been able to do this successfully?
Any help would be appreciated.
Thanks, Simon.
I have got into some difficulty when attempting to add Parts to the Parts table. To see what I am talking about, on Soap UI:
- Double click a Project
- Select the WS-Security Configurations tab
- Select the Outgoing WS-Security Configurations tab
- Add a New Configuration + Give it a name
- Add a new WSS Entry (Signature)
- See the Parts table.
Currently I am using the following code to try and populate this table:
--------------------------------------------------------------------------------------------------------
package com.eviware.soapui.impl.wsdl.support.wss.crypto;
import com.eviware.soapui.support.types.StringToStringMap;
def coredb = testRunner.testCase.testSuite.project.getWssContainer()
def outgoing = coredb.getOutgoingWssByName("Outgoing")
def signature = outgoing.addEntry("Signature")
List<StringToStringMap> list = new ArrayList<StringToStringMap>()
StringToStringMap parts = new StringToStringMap()
parts.put("ID", "")
parts.put("Name", "Timestamp")
parts.put("Namespace", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
parts.put("Encode", "Element")
list.add(parts)
signature.setParts(list)
------------------------------------------------------------------------------------------------
However, this seems to populate a blank row in the Parts table without the content I have specified.
Is this due to some mapping that I am missing? Has anyone been able to do this successfully?
Any help would be appreciated.
Thanks, Simon.