How to create an HTTP/S Virtual Service with a gzip request and response from a HTTP/S Virtual Service with a text request and response.

Document ID : KB000015993
Last Modified Date : 14/02/2018
Show Technical Document Details
Question:

I want to create a new Virtual Service using the following format:


Transport Protocol:HTTP/S
Request Body : gzip format
Response Body : gzip format

 

I have an existing Virtual Service (vsm and vsi files) with this format:


Transport Protocol:HTTP/S
Request Body : text
Response Body : text


which works fine.

Is it possible to create a new Virtual Service by using the old Virtual Service files and without programming and scripting?

Environment:
DevTest 9.0,9.1,9.5,9.5.1,10.0.0 and 10.1.0
Answer:

Yes, it is possible.
Please do the following steps:

  1. Open the VSI file for the Virtual Service which you want to change by DevTest Workstation
  2. In Service Image Editor, select one of transaction(s)
  3. In the META data for the transaction which "Match style" is "Signature", select "Meta Data" tab for the Transaction Request Data pane
  4. Add these keys and values to the "Meta Data"
    KeyValue
    Content-Encodinggzip
    Accept-Encodinggzip
  5. In the same META data, select "Meta Data" tab for the Transaction Response Data pane
  6. Add these keys and values to the "Meta Data"
    KeyValue
    WasGziptrue
    Content-Encodinggzip
  7. Repeat from step 3 to 6 for the Specific data(s) which "Match style"(s) is/are "Exact"
  8. If you need to change the multiple transactions then repeat from step 2 to 7
  9. Save the VSI file and deploy to Virtual Service Environment with VSM file

In this newly created virtual service, if you send a request with gzip format body, then you will receive a response with gzip format body, and if you send a request with text body then you will receive a response with gzip format body.