Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

I have a requirement to send sync and async response for a single request in Virtualize

dev007
dev007 Posts: 5

I have a requirement to send sync and async response for a single request in Virtualize. Please suggest me the way. The requirement is to send the sync reponse first then it will the the async one.

Comments

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    What protocol is being used in this case? I think for HTTP attaching a client tool to the "Outgoing Response > Transport Headers" will result in the async client tool being run after the response to the original HTTP request.

  • dev007
    dev007 Posts: 5

    HTTP protocol is being used here. Can you please elaborate in detail how can I do setup for the same so that I can send the sync response first and then the async one for a single request

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    For HTTP requests tools chained to a responder on the "Outgoing Response > Transport Header" will be executed after the sync response has already been sent. Right-click on a responder and click on "Add output" which will bring up a dialog where you can select the Transport Header of the Outgoing Response. Then select the tool you want to use, for example, a Messaging Client or a REST Client.

  • dev007
    dev007 Posts: 5

    Yes followed the same process.. but still getting the async response triggered first then sync is getting triggered.

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Could you share an example pva file? The tool has to be chained to that very specific output otherwise it will run before the sync response. Also, you may need to add a short delay, for example, a sleep using a script before the async response because it could be executed very fast right after the sync response.

  • dev007
    dev007 Posts: 5

  • williammccusker
    williammccusker Posts: 642 ✭✭✭

    Hi,

    From the screenshot, I see the "Messaging..." tool on the Outgoing Transport Header is the async callback? That appears to be in the right place.

    To add a delay before the client, chain an Extension tool to the Outgoing Transport Header and move it before the Messaging client. Use a simple script with a Thread sleep and that should add a delay between the sync response and the async response. If you add a delay does the async response get there after the sync response?

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    Asynchronous services typically don't send any response body, just a "200 OK". In the responder you would need to enable "Notification only" under "Options > Message Exchange Pattern".

    As William mentioned, you can chain other tools to the responder to perform additional messaging.

  • dev007
    dev007 Posts: 5

    Hi William, Not able to figure out the solution. Still having the same behavior. Is there any other way in which I can send synch first and then Asynch. Any scripting or anything.. that can help me. Please suggest.

  • sang_parasoft
    sang_parasoft Posts: 26 admin

    Hi dev007,

    If you have not registered Parasoft CustomerPortal, you can get direct help from our Parasoft technical support. Please use your company email to register https://customerportal.parasoft.com, and create a support case.