Forum Discussion
senthkum
Contributor
Hi Tanya,
All the info in there are related to SOAP service, but I am working on REST Service and I do not find a way to attach the PDF file and test it. It's been more than 2 weeks i am stuck with this issue.
Why is that, there is no attachment properties for a REST service, it would have been more easy.
can you help me with the code or is there any other simpler way to attach a file. The below code did not work.
// get the path to the folder where your project resides. def projectPath = new File(context.mockService.project.path).parent // Specify the file path that is relative to the project’s path. def fileName = projectPath + "\\response\\abcd.pdf" log.info "CABIS-MOCK send response with file: " + fileName import java.io.FileInputStream import java.io.File File f = new File(fileName) FileInputStream fis = new FileInputStream(f) byte[] b = new byte[f.length()] requestContext.mockResponse.responseContent = f.text
Thanks
Senthil kumar. M
TanyaYatskovska
6 years agoSmartBear Alumni (Retired)
Hi senthkum,
I think it's worth redirecting this question to our ReadyAPI Support Team - perhaps, some investigation along with the R&D team will be required. You can contact them here:
Related Content
Recent Discussions
- 22 days ago