虽然肥皂(免费版)有一个选项来导出生成的文件作为回应。有没有任何groovy函数来提取应用程序/ pdf文件并存储在我的本地文件夹?如何使用groovy从肥皂响应中导出pdf附件?
-2
A
回答
0
下面的脚本应该能够附件保存到文件中。
将以下脚本作为Script Assertion
添加到当前请求步骤。内嵌找到适当的评论。为脚本
来源是here
/**
* Below script assertion will check
* if the response is not null
* there is an attachment
* and saves file to the specified location, by default saves into system temp
* directory
**/
//change file name as needed
def fileName = System.getProperty('java.io.tmpdir')+'/test.pdf'
//Get the response and check if the response is not null
def response = messageExchange.response
assert null != response, "response is null"
//Create output stream
def outFile = new FileOutputStream(new File(fileName))
//Check if there is one attachment in the response
assert 1 == messageExchange.responseAttachments.length, "Response attachments count not matching"
def ins = messageExchange.responseAttachments[0]?.inputStream
if (ins) {
//Save to file
com.eviware.soapui.support.Tools.writeAll(outFile, ins)
}
ins.close()
outFile.close()
相关问题
- 1. 带附件的肥皂SAAJ
- 2. Flex 3和肥皂响应?
- 3. monodevelop解析肥皂响应
- 4. 如何使用groovy将测试套件导入肥皂用户界面
- 5. 如何在Spring中从肥皂消息中提取附件
- 6. 用LINQ解析肥皂响应
- 7. 肥皂响应标题中的日期
- 8. 如何使用WCF服务来实现肥皂响应
- 9. 如何使用肥皂处理器发送响应
- 10. 如何在javascript中使用肥皂
- 11. 带附件的肥皂在dot.net3.5
- 12. 如何使用自定义代码从HP UFT动态访问肥皂响应
- 13. tsql遍历xml肥皂响应
- 14. 解析肥皂响应问题(iphone/touchxml)
- 15. 肥皂UI动态请求和响应
- 16. 在JSP上显示肥皂响应
- 17. Android:不完整的肥皂响应?
- 18. 肥皂泡响应时间测量
- 19. 肥皂客户端的响应验证
- 20. selectSingleNode失败与肥皂响应VB6
- 21. asp.net不反序列化肥皂响应
- 22. 使用nusoap_client在php中读肥皂响应
- 23. 如何加快magento中的肥皂呼叫响应时间?
- 24. 如何在Python中伪造肥皂响应?
- 25. 如何在iPhone中的表视图加载肥皂响应
- 26. 如何在Android中显示SAP肥皂web服务响应?使用ksoap2
- 27. 如何从Java中的肥皂响应中获取错误消息
- 28. 如何开始使用肥皂ui
- 29. 如何使用zend肥皂生成wsdl
- 30. 无法使用SimpleXML分析肥皂响应
采取你tryed任何解决方案? – adalPaRi
@adalPaRi - 我是groovy的新手,但是知道VB脚本。我无法找到将提取PDF文件,与肥皂响应一起出现的函数。但是,我可以使用groovy在文本文件中保存响应。 – Rish