How to return a VSI response as PDF file

book

Article ID: 126760

calendar_today

Updated On:

Products

CA Application Test Service Virtualization CA Continuous Application Insight (PathFinder) CA Service Virtualization (DevTest / LISA / VSE / Application Test)

Issue/Introduction

This document describes the steps taken to configure a VSI transaction to send a PDF file in the response.

Environment

Release:
Component: ITKOVS

Resolution

Open the VSI and select the transaction that will return the PDF file as response.
Go to the response and change the response editor to General/ Binary.

<Please see attached file for image>

User-added image

Once you change the type of payload, the response tab will show three icons:

<Please see attached file for image>

User-added image
Select the first icon. It allows us to load the content of a local file into the response body.
Select the PDF file to be sent as response:

<Please see attached file for image>

User-added image

Select the second icon to save the content of the response body to a new local file.

<Please see attached file for image>

User-added image

Open the new file in a text editor and add the following information to the text file.
In the first line add:
------=_Part_0_1578916788.1457518808008 Content-Type: application/pdf Content-Transfer-Encoding: binary Content-ID: <EBF7DF6EAB32B0970B33B96138F6C306> 

In the last line add:
------=_Part_0_1578916788.1457518808008---------- 

There are no spaces and empty lines before and after these lines.
Save the modified file. 

Back in the VSI response, reload the modified PDF file in the response, using the load icon.

<Please see attached file for image>

User-added image

In the Response Meta Data, modify or add the the header Content-Type = application/pdf.

<Please see attached file for image>

User-added image

Save the VSI and deploy the VSM to the VSE Service.
This will load the PDF file when the request sent matches this specific transaction.

To send the PDF file as an attachment that will be downloaded to the local 'Download" folder, add the Content-Disposition as attachment:

<Please see attached file for image>

User-added image

Save the VSI and deploy the VSM to the VSE Service.

Attachments

1558689560502000126760_sktwi1f5rjvs16fzh.png get_app
1558689558677000126760_sktwi1f5rjvs16fzg.png get_app
1558689556842000126760_sktwi1f5rjvs16fzf.png get_app
1558689555100000126760_sktwi1f5rjvs16fze.png get_app
1558689553455000126760_sktwi1f5rjvs16fzd.png get_app
1558689551722000126760_sktwi1f5rjvs16fzc.png get_app
1558689548451000126760_sktwi1f5rjvs16fzb.png get_app