def response = context.expand( '${Generate Signed URL#Response#$[\'SignedURL\']}' ) def a = response.tokenize("?")[1]; def paramValue = a.tokenize("&"); for(def value: paramValue){ def v = value.tokenize("="); log.info(v[0] +' = '+v[1]); testRunner.testCase.setPropertyValue( v[0],v[1]); } // encode file ResultsPath = context.expand( '${#TestSuite#root}' ) def inputFile = new File(ResultsPath) String encoded = inputFile.bytes.encodeBase64().toString() testRunner.testCase.setPropertyValue("EncodedFileRequest", "$encoded" ) // get request //def request = testRunner.testCase.getTestStepByName( "AttachmentContentRequest" ).testRequest // clear existing attachments //for( a in request.attachments ) { //request.removeAttachment( a ) //} // get file to attach ResultsPath = context.expand( '${#TestSuite#root}' ) def file = new File(ResultsPath) def url = response; def connection = url.toURL().openConnection(); connection.setRequestMethod("PUT") connection.setRequestProperty("Content-Type", 'application/pdf'); connection.setRequestProperty("Content-Length", '0'); if ( file == null) { log.info "bad filename" } else { // attach and set properties def attachment = connection.attachFile( file, true ) attachment.contentType = "base64Binary" attachment.setPart( "Message" ) } def responseCode = connection.getResponseCode() log.info(responseCode)