Skip to content

Instantly share code, notes, and snippets.

@banterCZ
Last active April 28, 2016 14:11
Show Gist options
  • Save banterCZ/fc15206069fbd7f8583a to your computer and use it in GitHub Desktop.
Save banterCZ/fc15206069fbd7f8583a to your computer and use it in GitHub Desktop.
Soap UI WS mock script
def request = mockRequest.requestContent
log.info "CA Request: $request"
def payload = new XmlSlurper().parseText(request)
def csr = "${payload.Body.issueCertificate.paramIn.pkcs10}"
def temp = File.createTempFile('temp', '.csr')
temp.deleteOnExit()
temp.write(csr)
log.info "Created a temp file '$temp'"
def path = context.expand('${projectDir}/')
def openSslCommand = "openssl x509 -req -CA ${path}ca.pem -CAkey ${path}ca.key -CAcreateserial -days 500 -in $temp.absolutePath"
log.info "Going to call command '$openSslCommand'"
def certificate = openSslCommand.execute().text
requestContext.cert = certificate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment