Return to Snippet

Revision: 67109
at August 12, 2014 23:50 by lucaborace


Initial Code
import org.apache.commons.codec.binary.Base64

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "RequestTest#Response" )
// define namespace
// Populate these
holder.namespaces["ns12"] = ""
holder.namespaces["ns23"] =""

def textBase64 = holder.getNodeValues( "//ns12:createReportResponse[1]/return[1]/ns23:output[1]" ).toString()

def b64 = new Base64()
def zipTextBytes = b64.decode(textBase64.getBytes())

def zipFile = new java.io.File("report.pdf")
FileOutputStream fos = new java.io.FileOutputStream(zipFile)
fos.write( zipTextBytes )
fos.flush()
fos.close()
log.info "Temporary PDF file stored as: ${zipFile.getCanonicalPath()}"

Initial URL

                                

Initial Description
Salvare la response su file

Initial Title
Saving SOAPui Response base64 to file

Initial Tags

                                

Initial Language
Groovy