jdario
7 years agoOccasional Contributor
Reading SOAP Request Attachment using Groovy
Hello,
I have a SOAP request with an attachment. I'm trying to read the attachment, generate it's SHA-256 hash, and put the value in the request before sending. I've found various snippets of each step in the community, but nothing seems to work.
This is what I have so far in my Groovy script:
import java.security.MessageDigest
def attachment = testRunner.testCase.testSteps['SOAP Request'].httpRequest.getAttachmentAt(0).data
def digest = MessageDigest.getInstance("SHA-256")
def sha256 = { var.java.security.MessageDigest.getInstance("SHA-256").digest(attachment).toString()}
The result I get is: "Script-result: Script54$_run_closure1@6fa2bce9"
Any help is appreciated.
Thanks