Forum Discussion

Dexter's avatar
Dexter
New Member
6 years ago

Failed to configure parts in outgoingWss with SignatureEntry

 

I am tring to build signature entry from scratch. The signature entry was created as expected, but the signature parts list is empty.

 

The code:

 

def project = testRunner.testCase.testSuite.project
def container = project.getWssContainer()
def outgoing = container.getOutgoingWssList()[0] // One and only element

def signature = (SignatureEntry)outgoing.addEntry("Signature")
signature.setCrypto("KeyStore.jks")
signature.setUsername("test_software")
signature.setPassword("<key password>")
signature.setKeyIdentifierType(1)
signature.setSignatureAlgorithm("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256")
signature.setSignatureCanonicalization("http://www.w3.org/2001/10/xml-exc-c14n#")
signature.setDigestAlgorithm("http://www.w3.org/2001/04/xmlenc#sha256")
signature.setUseSingleCert(true);   
signature.saveConfig()

StringToStringMap timestamp = new StringToStringMap()
timestamp.put("ID", "")
timestamp.put("Name", "Timestamp")
timestamp.put("Namespace", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd")
timestamp.put("Encode", "Element")

StringToStringMap body = new StringToStringMap()
body.put("Name", "Body")
body.put("Namespace", "http://www.w3.org/2003/05/soap-envelope")
body.put("Encode", "Element")

List<StringToStringMap> parts = new ArrayList<StringToStringMap>()
parts.add(timestamp)
parts.add(body)
signature.setParts(parts)
signature.saveConfig()

 

 

The result:

 

 

Any idea or suggestion?

 

No RepliesBe the first to reply