cancel
Showing results for 
Search instead for 
Did you mean: 

Send PDF as a response in ServiceV pro?

Contributor

Send PDF as a response in ServiceV pro?

Hi Team,

 

I have a requirement where I need to send everytime the same PDF as a response. It is a REST service, Could some one help me, Where can I attach the file and continue the testing in serviceV Pro.

Note: I am not talking about SOAPUI or SOAPUI Pro.

 

Thanks

Senthil kumar.M

3 REPLIES 3
Highlighted
Community Manager

Re: Send PDF as a response in ServiceV pro?

Hi @senthkum,

 

Please check if the replies given in this topic help you:

https://community.smartbear.com/t5/SoapUI-Pro/Add-a-pdf-as-an-attachment-for-a-mock-response/td-p/12...

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Contributor

Re: Send PDF as a response in ServiceV pro?

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

Community Manager

Re: Send PDF as a response in ServiceV pro?

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:

https://support.smartbear.com/message/?prod=readyapi

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
New Here?
Join us and watch the welcome video: