雖然肥皂(免費版)有一個選項來導出生成的文件作爲迴應。有沒有任何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