Service Virtualization

Expand all | Collapse all

Building a proxy service for routing requests to different endpoints

  • 1.  Building a proxy service for routing requests to different endpoints

    Posted Nov 28, 2016 01:39 AM

    Hi All,

     

    We have a constraint where only one endpoint can be configured to route the requests to LISA service. But we are planning to build separate virtual service for each operation. Is there any approach where we can create a service which receives all requests and routes to different endpoints for each service ?

     

    Thanks

     

    Regards,

    Venkatesh K 



  • 2.  Re: Building a proxy service for routing requests to different endpoints
    Best Answer

    Posted Nov 28, 2016 01:29 PM

    One approach for HTTP-based services is to set up a dummy service that routes to the other services.  An abbreviated example is:

    - Start with a sample VSM having all the steps

    - Remove all the steps leaving just a  the LISTEN -> LIVE INVOCATION -> RESPONDER steps.  You will not likely need tracking, failover, learning and all the other modes in this service.  Additionally, you can remove the assertions/branches for these from the steps.

    - Add script logic of your choice (i.e., Scriptable DPH, scripted assertion, JSR step, etc.) to examine the incoming request and decide which endpoint the request is sent to.

    - Using this logic set a target Host and target port property value on TestExec ( i.e., testExec.setStateValue("HOST", "hostName1");  )

    - In the Live Invocation step, use {{ }} notation to refer to your target {{HOST}} & {{PORT}}

    - In the Live Invocation step, do NOT check format step response as XML.  

    - The Responder step should send its response from the lisa.vse.response property 

     

    The idea is that this service marshals requests and responses but does not manipulate the request or the response.

    If your scenario has to support both SSL and non-SSL targets, then you will need two Live Invocation (one with and one without SSL) steps and some branching logic to decide which one to use.  Both steps still branch to the Responder step.  You will not be able to LISTEN for both HTTP and HTTPS with the same service though.