Forum Discussion

Clawzix's avatar
Clawzix
Occasional Contributor
3 years ago
Solved

How to get a file which is in a tag?

Hello,   Sorry, I don't speak english really well...   I made a request based on a wsdl, i was searching for a .zip file and I got it in a tag. Please can you tell me how to make this file in a ...
  • nmrao's avatar
    nmrao
    3 years ago

    Clawzix 

    This is based the image you provided.

    Script is based on assumptions. you need to test it.

    Add the below script as Script Assertion for the SOAP Request test step

     

     

    assert context.response
    def zipContent = new XmlSlurper().parseText(context.response).'**'.find{it.name() == 'MessageZip'}.text()
    def zipFile = new FileOutputStream(new File(System.getProperty('java.io.tmpdir')+'/test.zip'))
    def inStream =  new ByteArrayInputStream( zipContent.getBytes( 'UTF-8' ) )
    if (inStream) {
       com.eviware.soapui.support.Tools.writeAll(zipFile, inStream)
    }
    inStream.close()
    zipFile.close()