Service Virtualization

Expand all | Collapse all

same responses is being sent irrespective of the requests being received from the Application

  • 1.  same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 08, 2018 09:25 AM

    Hi All,

     

    VS using MQ/XML protocol:

     

    1.  The request from the application comes in zip format and VS is designed to unzip the file(contains Request XML) and read the XML file into the VS. (before every next request from the application, the old request files gets deleted from the directory).

    2.  VS is designed to send two responses one after the other using MQ transport protocol. And the responses were not static.  Have added XML xpath filter to extract the argument values from Request XML and store it in a property. the same properties is used and parameterized in the two response XMLs in the VSI.

    3. deployed the VS to the VSE.

     

    i'm using DevTest 9.5 with MQ deprecated step.

     

    The issue is:

     

    for the first request from application, VS is sending the two responses back to the application taking proper parameterized values from request.

    but for all subsequent requests, VS is sending the two responses same as that as it had sent for the first request. Hence at the application side it is failing.

     

    Could you please let me know what could be the reason of this behavior? 



  • 2.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 08, 2018 02:14 PM

    For the moment, too little information for proper root-cause analysis of the behaviour you experience.

     

    Does the second incoming request have different data values then the first request? If not and the second incoming request has exactly the same data values but you want to return a different response then you need a stateful virtual service aka a "Conversation" 

     

    Let's assume that is not the case and stateless would be ok for your requirements.

    How many exact transactions with a different response do you have in your virtual service image?

    • only a META response (aka Default response) and no exact transactions?
    • one META and one exact transaction?
    • one META and how many exact transactions?

    If you go into the Portal, open the Monitor pane, select your VSE, then for your virtual service look at the Inspection View and the matches that have been made. Which transaction id is being returned? In your virtual service image you can see what transaction id belongs to what META or exact transaction.

    Chances are high that the virtual service never returns an exact match but instead always returns the META, i.e. always the Default response.



  • 3.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 09, 2018 04:36 AM

    Hi Danny,

     

    Please find my answers below:

    1. Each request will contain different data values.

    2. only one META transaction is configured. there are no Exact transactions in the VSI. (please find the screenshot of the attachment)

    3. i checked in the VSE logs of that particular VS, where incoming request and responses gets logged. there i could see that response is being taken from META for all incoming Requests.

     

    In the META transaction, i have parameterized the values, so that values will be taken from request every time. but this is not happening instead always the first transactions responses are being sent back.

    VSI-META transaction



  • 4.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 09, 2018 06:45 AM

    Ok, you only have a META, so the matching is not the problem.

     

    The problem is getting the data values from your incoming requests into the properties {{reqid}} and {{batchid}}

     

    Now, we see from your transaction signature that there are no arguments, only an operation. So, magic stringing is NOT the mechanism that you use. (also if magic string was used then the properties would be {{request_reqid}} and {{request_batchid}})

     

    Also, is seems that in your Listen step you do NOT use a Request Data Copier to copy data from your request into the testexec environment. Because again, in that case the properties would have the same prefix (again, the default would have been {{request_reqid}} and {{request_batchid}})

     

    Actually, it appears that you have a customized virtual service, not? From your original description "The request from the application comes in zip format and VS is designed to unzip the file(contains Request XML) and read the XML file into the VS.". It appears there is no Listen step which is taking a message from a queue? Instead you read the contents of a file. How do you create the lisa.vse.request object? (This object is used by the "VS Image Response Selection" step to match with the META)



  • 5.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 09, 2018 07:09 AM

    Yes it is a Customized VS. I havent used the magic string because the incoming request from the application is in bytes and is in zip format. hence i could not use Request Data Copier to copy data from the request into the testexec environment in the Listen step.

    1. There is a listen step in the VSM. i had to first  get the bytes from the incoming request in the listen step (using scriptable data protocol filter using following two lines of code) and store the property value in a .zip format in a server location (using save property value to a file  filter. Location given something like this: {{LISA_HOME}}data/Zip/req.zip) in local directory.

     

    byte[] bytemsg=lisa_vse_request.getBodyBytes();

    testExec.setStateValue("bytemsg", bytemsg);

     

    2. unzip the folder using execute External Command. where i had to write a unix command to unzip the .zip folder from the location (point 1).the command used is : unzip {{LISA_HOME}}data/Zip/req.zip -d {{LISA_HOME}}data/Zip/

     

    3.read the file(requestXML) from point 2 into VSM and store it into another property add the xml xpath filter on top of this property.



  • 6.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 09, 2018 07:50 AM

    Please excuse me for butting in at this point, but you have a byte array of the zip contents. Instead of writing out a file, why not use the built-in unzipping facilities available in Java scripting, so you can return the XML data from your scriptable DPH. Save this as the DevTest request object and you can use the DevTest intelligence for Request Data Manager, matching, magic strings, etc.

     

    This would be the request-side companion to Danny's answer to your previous question how to convert zip file to byte content  

     

    None of this is syntax-checked - I have pasted parts of a Stack Overflow response to a similar question and modified it a little for use in DevTest:

    byte[] bytemsg=lisa_vse_request.getBodyBytes();
    java
    .util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(bytemsg);java.io.ByteArrayOutputStream byteout = new java.io.ByteArrayOutputStream();int res = 0;byte[] buf = new byte[65536]; //if your payload can be more than 64k, increase thiswhile (res >= 0) {    res = gzin.read(buf, 0, buf.length);    if (res > 0) {        byteout.write(buf, 0, res);    }}byte[] uncompressedBytes = byteout.toByteArray();
    String uncompressedRequest = new String(uncompressedBytes);
    lisa_vse_request.setBodyText(uncompressedRequest);

     

    All this is much easier if you are using HTTP, because it has a specific standard for zip & unzip, using a header value called "content-encoding", so DevTest automatically zips and unzips as required. MQ doesn't include such a standard, so we need to do it manually like this.



  • 7.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 09, 2018 08:00 AM

    I was writing out the below similar to what Rick just posted as the direction for a less complex solution.  I refer to Rick’s implementation of the Scriptable Data Protocol Handler.

    What I had written out so far:

     

    It seems to me the problem is either in step 2 or step 3.

     

    To assess step 2, I assume that you have validated that with every new incoming request the file requestXML is actually created again with new values? On unix you could have an issue with file permissions whereby this commands effectively runs but no new file is created and the old file continues to be used. But come to think of it, I seem to vaguely recall that there might be an issue whereby DevTest uses a cached version of the file content and never rereads the file content if the file has the same name.

     

    But to be honest, it seems you have made this more complex than it should be.

    The idea within a .vsm is that you keep applying Data Protocol Handlers on the lisa.vse.request object until you have it transformed into a structure that matches the structure of your transactions in your virtual service image.

     

    So, in your scriptable data protocol filter you should get the bytes, unzip them in memory, and then store them back into the request body.

    Now your lisa.vse.request body contains an XML like a regular webservice.

    And after your scriptable data protocol filter you can apply a XML DPH which parses that XML.

    The result of this XML DPH will be that you now have arguments, if you add those arguments to your virtual service image then you can use magic string to get them into your response.

     

     

    Cheers,

    Danny



  • 8.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 10, 2018 01:55 AM

    yes Danny and Rick. i totally agree with your points. the reason in going with this approach is that i didnt find any script that will uncompress the file and return a XML.

    i tried using the java script code in Scriptable data protocol filter as suggested by Rick . but somehow getting  the below Run time exception.

    do we need to import any class before we make of this code? or

    Could you please suggest me if i'm missing anything out here?

     

    Did not get a valid Request object so we ignore processing this transaction.
    java.lang.RuntimeException: Exception evaluating script: bsh.EvalError:

     

    import com.itko.util.ParameterList;

    byte[] bytemsg=lisa_vse_request.getBodyBytes();

    testExec.setStateValue("bytemsg", bytemsg);

    java.util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(bytemsg);
    java.io.ByteArrayOutputStream byteout = new java.io.ByteArrayOutputStream();
    int res = 0;
    byte[] buf = new byte[65536];
    if(res >= 0)
    { res = gzin.read(buf, 0, buf.length);
    if (res > 0)
    { byteout.write(buf, 0, res);
    }
    }
    byte[] uncompressedBytes = byteout.toByteArray();
    String uncompressedRequest = new String(uncompressedBytes);
    testExec.setStateValue("uncompressedRequest", uncompressedRequest);
    lisa_vse_request.setBodyText(uncompressedRequest);

     

     

     


    : <at unknown location>
    at com.itko.lisa.vse.stateful.protocol.scriptable.ScriptableDataProtocolHandler.updateRequest(ScriptableDataProtocolHandler.java:72)
    at com.itko.lisa.vse.stateful.common.DataProtocolStandardControlFilter.subPostFilter(DataProtocolStandardControlFilter.java:232)
    at com.itko.lisa.test.FilterBaseImpl.subFilter(FilterBaseImpl.java:148)
    at com.itko.lisa.test.FilterBaseImpl.postFilter(FilterBaseImpl.java:122)
    at com.itko.lisa.test.TestNode.doFilters(TestNode.java:1464)
    at com.itko.lisa.test.TestNode.doPostFilters(TestNode.java:1421)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
    at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
    at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
    at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Unknown Source)

     

    Thanks In Advance



  • 9.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 10, 2018 02:06 AM

    Yes, you would need import statements. Have a go using the below:

     

    import com.itko.util.ParameterList;

    import java.io.ByteArrayOutputStream;

    import java.io.IOException;

    import java.util.zip.GZIPInputStream;

     

    Cheers,

    Danny



  • 10.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 10, 2018 02:27 AM

    Hi Danny,

     

    added the import statements, but facing the  same Run time exception again.:

    could you please look into it.

     

    Did not get a valid Request object so we ignore processing this transaction.
    java.lang.RuntimeException: Exception evaluating script: bsh.EvalError:

    import com.itko.util.ParameterList;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.util.zip.GZIPInputStream;

    byte[] bytemsg=lisa_vse_request.getBodyBytes();

    testExec.setStateValue("bytemsg", bytemsg);

    java.util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(bytemsg);
    java.io.ByteArrayOutputStream byteout = new java.io.ByteArrayOutputStream();
    int res = 0;
    byte[] buf = new byte[65536];
    if(res >= 0)
    { res = gzin.read(buf, 0, buf.length);
    if (res > 0)
    { byteout.write(buf, 0, res);
    }
    }
    byte[] uncompressedBytes = byteout.toByteArray();
    String uncompressedRequest = new String(uncompressedBytes);
    testExec.setStateValue("uncompressedRequest", uncompressedRequest);
    lisa_vse_request.setBodyText(uncompressedRequest);

     

     

     


    : <at unknown location>
    at com.itko.lisa.vse.stateful.protocol.scriptable.ScriptableDataProtocolHandler.updateRequest(ScriptableDataProtocolHandler.java:72)
    at com.itko.lisa.vse.stateful.common.DataProtocolStandardControlFilter.subPostFilter(DataProtocolStandardControlFilter.java:232)
    at com.itko.lisa.test.FilterBaseImpl.subFilter(FilterBaseImpl.java:148)
    at com.itko.lisa.test.FilterBaseImpl.postFilter(FilterBaseImpl.java:122)
    at com.itko.lisa.test.TestNode.doFilters(TestNode.java:1464)
    at com.itko.lisa.test.TestNode.doPostFilters(TestNode.java:1421)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:995)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1288)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1203)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1188)
    at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1058)
    at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:71)
    at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:965)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Unknown Source)

     

    Thanks



  • 11.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 10, 2018 02:39 AM

    Won’t be able to do that right away, but I’ll have a look asap.

     

    And apologies, I was wrong about needing import statement, I noticed that Rick has used full java paths including packages for any not standard known java classes, so no need to import those. So, that also explains why the error hasn’t changed.

     

    Cheers,

    Danny



  • 12.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 10, 2018 02:44 AM

    oh okay..No problem Danny.

    your help will be much appreciated.

     

    Thank You.



  • 13.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 10, 2018 04:09 AM

    I am having some issues testing this myself, but there is at least one correction to be made. Can you replace the statement:

     

    java.util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(bytemsg);

     

    with this statement:

     

    java.util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(new java.io.ByteArrayInputStream(bytemsg));

     

    Let us know if it makes a difference.

     

    Cheers,

    Danny



  • 14.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 10, 2018 04:59 AM

    Hi Danny,

     

    replaced the statement to :

    java.util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(new java.io.ByteArrayInputStream(bytemsg));

     

    and tested. same exception again.

     

    Thanks



  • 15.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 10, 2018 05:36 AM

    Ok, unfortunately you don't seem to have the debug info of where your script fails? Is it possible to run your .vsm in the workstation within the ITR? I am expecting that you will see error messages like "Not a GZIP Format".

     

    At least that was what I was getting with my zipped payloads. Can you replace again that statement with the below:

     

    java.util.zip.ZipInputStream gzin = new java.util.zip.ZipInputStream(new ByteArrayInputStream(bytemsg));

     

    I would expect that now you would not see that Runtime Exception again?

     

    But it probably still won't work, I am not an expert on the internal structure of zip files, but it appears that zipfiles have entries, each file that was zipped up will have its own entry. If the above fixes the runtime exception but now leaves your request body empty (that what happens with me) then we will try one more adaption whereby we will try to unzip the next entry within the zipped payload.



  • 16.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 10, 2018 07:25 AM

    Hi Danny,

     

    whatever results i have shared with you were all results executed using ITR.

    im out of office now. will test it again tomorrow and share my observations on the same.

     

    Thanks



  • 17.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 10, 2018 10:08 AM

    Is it possible for you to provide a raw recording file of your service, so we can see whether the compressed message includes header information (the Java calls needs to change, depending on what information is in the compressed data)?

     

    To store a raw recording, type a filename in the "Export to:" box on the first page in the generation wizard.

     

    You can also provide a recording settings (VRS) file. On the final page of the generation wizard, there's a little file icon. If you press this icon, you can save the settings (your queue/topic names, etc)



  • 18.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 11, 2018 02:03 AM
      |   view attached

    Hi Rick,

     

    i have created the VS using request/response pair initially over MQ deprecated protocol.

    where request and response used are plain XML and there is no compressed message used while creating this VS.

     

    To give you the background: the req/res flow diagram as given below :

     App1 -> App2->VS

    1. In the old requirement there is no compressed message coming from the App2, request will come in plain XML to the VS ( and this is working fine and setup is already there).[one of the header values of request will be False for this type ]

    2. Now that the project requires an additional functionality in the same VS, that there are scenarios where request may also come as compressed message to the VS.[one of the header values  of request will be True for this type ]

     

    if the occurence of <ToDetails> sections is greater than 1000 in the incoming request from App1 to App2 then Point 2 gets triggered where request file size is more.and hence App2 is sending compressed request to the VS.

    if the occurence of <ToDetails> sections is less than 1000 in the incoming request from App1 to App2 then Point 1 gets triggered where request file size is less and hence App2 sends the plainXML request to VS without compression.

     

    Now that we are trying to append point 2 functionality in the existing point 1 functionality VS.

     

    i have attached the compressed request file that comes from the application to VS for your reference. Please extract and open in a notepad, you will be able to see the incoming requestXML.

     

    Please let me know if you need any more information on the same.

     

    Thanks



  • 19.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 11, 2018 07:24 AM
      |   view attached

    This is what I've done:

     

    I increase the memory available to Workstation, as your data is large. In Workstation.vmoptions, I add the line

    -Xmx2g

     

    I suggest you want to do this in VirtualServiceEnvironment.vmoptions (or VirtualServiceEnvironmentService.vmoptions, if you're running that executable instead) as well

    I read your file as input data.

     

    I make some assumptions about the compression involved, and I compress your data in a JSR-223 step like this:

    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.util.zip.GZIPOutputStream;

    String str = testExec.getStateValue("requestMessage");
    if (str == null || str.length() == 0) {
      return str;
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    GZIPOutputStream gzip = new GZIPOutputStream(out);
    gzip.write(str.getBytes());
    gzip.close();

    zipString = out.toString("ISO-8859-1");
    zipBytes = out.toByteArray();

    testExec.setStateValue("zipString", zipString);
    testExec.setStateValue("zipBytes", zipBytes);

    return out;

     

     

    So I now have both a string and a byte array of the data.

     

    I take my suggested Scriptable DPH code from above, add Danny's casting change, and it looks like this:

    //byte[] bytemsg=lisa_vse_request.getBodyBytes();
    byte[] bytemsg=testExec.getStateValue("zipBytes");

    java.util.zip.GZIPInputStream gzin = new java.util.zip.GZIPInputStream(new java.io.ByteArrayInputStream(bytemsg));
    java.io.ByteArrayOutputStream byteout = new java.io.ByteArrayOutputStream();
    int res = 0;
    byte[] buf = new byte[65536]; //if your payload can be more than 64k, increase this
    while (res >= 0) {
      res = gzin.read(buf, 0, buf.length);
      if (res > 0) {
        byteout.write(buf, 0, res);
      }
    }
    byte[] uncompressedBytes = byteout.toByteArray();
    String uncompressedRequest = new String(uncompressedBytes);
    //lisa_vse_request.setBodyText(uncompressedRequest);
    return uncompressedRequest;

     

     

    I run it all as a test. It runs successfully and outputs the same XML as was read in the first step. Therefore the unzip routine is functional, given my assumptions as to how your real data would be compressed.

     

    I decrease the buffer length to 4096, and it appears no make no functional difference, so I leave it like this:

    byte[] buf = new byte[4096];

     

    So it looks like it's all working.

     

    Be careful when you copy from the above and paste it into Workstation, because there might be some "browser magic" happening to ruin the result - for example, make sure you overwrite all double-quotes with the " character, in case your browser helpfully converted them to "open-double-quotes" and "close-double-quotes". I've attached my test case if you want to get the scripts from there.

     

    You want to uncomment the two lines in the Scriptable DPH that expect it to be run inside a virtual service, and you want to comment out the "byte[] bytemsg=testExec.getStateValue("zipBytes");" line. You also want to put it all in an "if" statement, so it only runs the routine if your header value is set to "true"

     

    In your stack of data protocol handlers, this scriptable one needs to be before any XML processing.

     

    Finally, you probably want to look at a response-side recording scriptable DPH to do something similar for the response, and then a response-side replay scriptable DPH as an unzip.

    Attachment(s)

    zip
    customer_data.tst.zip   1 KB 1 version


  • 20.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 12, 2018 07:13 AM
      |   view attached

    Hi Rick,

     

     

    i had a look at your test case and ran the test case in my local too and is working fine.

     

    to avoid the "browser magic " in copy and paste that you referred, i had typed each line of code manually in the scriptable data protocol filter of Listen step and ran the VSI through ITR.    

     

    getting the same  warning message as mentioned in my previous reply:  "did not get a valid Request object so we ignore processing this transaction.
    java.lang.RuntimeException: Exception evaluating script: bsh.EvalError: "

     

    Then in the scriptable data protocol filter, i added few set statements(screenshot as below) to identify which line of code is causing this issue.came to know that at  the below line of code itself this exception has occured and hence it is skipping the next statements below. (i have tried with and without importing statements)

    java.util.zip.GZIPInputStream gzin=new java.util.zip.GZIPInputStream(new java.io.ByteArrayInputStream(bytemsg));

     

     

    i had also added JSR-223 step after Listen step to see if this code runs fine out there by  typing all the lines of code to avoid copy and paste. the step aborted with an error at the same statement:

    java.util.zip.GZIPInputStream gzin=new java.util.zip.GZIPInputStream(new java.io.ByteArrayInputStream(bytemsg));

     

     

    please find the Attached for  the full error message.

    Attachment(s)



  • 21.  Re: same responses is being sent irrespective of the requests being received from the Application

    Broadcom Employee
    Posted Oct 12, 2018 07:53 AM

    The error message states: Target exception: java.util.zip.ZipException: Not in GZIP format

     

    You need to find out what exactly has been compressed/zipped up at the client side. Was it “gzip” or “regular zip”? Depending on that you either need to use java.util.zip.GZIPInputStream or java.util.zip.ZipInputStream.

     

    Also if it was a file that was compressed, then the zip consist of (file) entries, and you might need to fetch it from the inputstream by the getNextEntry() method.

     

    However, if you are failing on that line of code then you are not yet in the position to get the next entry. Have you tried with java.util.zip.ZipInputStream? What is the error message in that case?

     

    Cheers,

    Danny



  • 22.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 15, 2018 08:00 AM

    Hi Danny,

    yes it is a a regular zip file that is compressed at client end.

     

    Replaced  GZIP with java.util.zip.ZipInputStream and ran the test. now there are no errors at all.

     

    but the code is returning null . As suggested by you we may need to add getNextEntry() method to input stream.

     

    Thanks,

    Sumalatha



  • 23.  Re: same responses is being sent irrespective of the requests being received from the Application
    Best Answer

    Broadcom Employee
    Posted Oct 15, 2018 08:07 AM

    Good to hear,

     

    getNextEntry() is simple enough to add. It just goes on the next line after the instantation of the ZipInputstream. I believe the variable in which this is stored was called gzin (if different then adapt the variable when adding following line)

     

    gzin.getNextEntry();

     

     

    Cheers,

    Danny



  • 24.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 16, 2018 08:02 AM

    Hi Danny,

     

    yes after adding  getNextEntry() method, zip file is extracted properly and could see uncompressed request.

     

    Thanks a lot for your support Danny and Rick!



  • 25.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 18, 2018 04:15 PM

    Hi,

     

    I have similar requirement for one of the project. If possible, please share your VSI and VSM files for go through the process.

     

    Thanks,

    Venu



  • 26.  Re: same responses is being sent irrespective of the requests being received from the Application

    Posted Oct 24, 2018 08:22 AM

    Hi,

     

    i have made only one change for this in listen step- scriptable data protocol filter: PFB the code:

    byte[] bytemsg=lisa_vse_request.getBodyBytes();

    testExec.setStateValue("bytemsg", bytemsg);


    java.util.zip.ZipInputStream gzin=new java.util.zip.ZipInputStream(new java.io.ByteArrayInputStream(bytemsg));


    gzin.getNextEntry();

    java.io.ByteArrayOutputStream byteout=new java.io.ByteArrayOutputStream();

    int res=0;

    byte[] buf=new byte[65536];

    while(res>=0) {
    res=gzin.read(buf, 0, buf.length);

    if(res>0){
    byteout.write(buf, 0, res);
    }
    }

    byte[] uncompressedBytes=byteout.toByteArray();

    String uncompressedRequest=new String(uncompressedBytes);

    testExec.setStateValue("request",uncompressedRequest);
    lisa_vse_request.setBodyText(request);

     

    hope it helps!