Service Virtualization

Expand all | Collapse all

unzip the incoming request in VS

  • 1.  unzip the incoming request in VS

    Posted 09-06-2018 06:40 AM

    Hi All,


    There's a requirement for a VS, for one of the scenarios, the request xml will be zipped by upstream application  and send that zipped request file to the stub or Virtual Service.

    And VS need to unzip the request file and process it as normally and while sending back the response (xml) , VS should zip the response (or compress the response) back to the application. 

    (size of the incoming request xml  from application is  > 3 MB file , the size is more because request XML carries around 5000 and more sections of <customerInfo> in it. application will zip this > 3MB file and send to the VS)


    Inside the VSM,  for example if there are 5000 sections of <Customer> is coming in the incoming request then VSM will append those 5000 <Customer> sections( using java script )in the response XML and send back. this logic is already in place.


    Now the question is: How to unzip the incoming request and zip the response xml while sending back to the application?


    is there any feasibility of this requirement in LISA?


    J_NeSmith  Ulrich_Vogt


    im using DevTest 9.5 and the VS protocol is MQ/xml. 




  • 2.  Re: unzip the incoming request in VS

    Posted 09-06-2018 09:14 AM

    Hi Sumalatha,


    I recommend using the Scriptable DPH as the first request side handler and the last response side handler:


    Scriptable Data Protocol - DevTest Solutions - 10.3 - CA Technologies Documentation 


    You can write a simple script to replace the request body with an uncompressed version as well as replace the response body with a compressed version.



  • 3.  Re: unzip the incoming request in VS

    Posted 09-07-2018 04:10 AM

    Thanks Mike for your inputs.

    could you please let me know the lisa in built property where this zip file (zipped requestXML from the application)  by default store into?


    so that i can make use of that property and parse it for uncompromising it.




  • 4.  Re: unzip the incoming request in VS

    Posted 09-07-2018 07:47 AM

    Hi Sumalatha,


    I recommend looking at the sample script generated by the Scriptable DPH for details on how to work with the incoming request object.  The variable "lisa_vse_request" will refer to the object, and I believe the getBody() and setBody() methods are the ones you'll want to use.



  • 5.  Re: unzip the incoming request in VS

    Posted 09-10-2018 12:04 AM

    thanks Mike.

  • 6.  Re: unzip the incoming request in VS

    Posted 09-10-2018 08:00 AM

    Hi Mike,


    It would be great if you can suggest me the code to replace the request body with an uncompressed version.

    [  upstream application is converting  the requestxml to byte msg and compressing it and sending to the VS]


    PFA the properties captured on ITR.


    for getting bodyText() i have used following line of code:


    String req=lisa_vse_getBodyText();


    in the VS, we have to uncompress the body text and convert it to xml.





  • 7.  Re: unzip the incoming request in VS

    Posted 09-11-2018 01:46 AM

    Hi Mike,


    since the upstream application is converting the request to byte and then compressing and sending to the VS via MQ, in the VS,  i have written the following line of code to read the byte array first:


    1. byte[] bytemsg=lisa_vse_request.getBodyBytes();

        testExec.setStateValue("bytemsg", bytemsg);


    2. added a filter: save property to a file: actually saves this bytemsg value extracted in the step 1 to a location path  in .zip format.({{LISA_HOME}} directory) 


    3. im able to manually unzip the file and could see that the content of the file which is a xml.


    a) could you please let me know how to unzip the file placed in the {{LISA_HOME}} directory in the tool (step 3)?  or

    b) is there any other way to unzip the request file?