Service Virtualization

Expand all | Collapse all

Virtual Service is going into a loop and getting executed continuously

Premalatha Gadde

Premalatha GaddeMar 22, 2017 11:49 AM

  • 1.  Virtual Service is going into a loop and getting executed continuously

    Posted Mar 21, 2017 12:12 PM

    Hi team,

     

    I am creating a SOAP based virtual service and I am adding some WebService Execution steps also after the HTTP Responder Step as I need to send some asynchronous responses to a specified target URL in the interval of 10 seconds.

    The flow is working fine but the issue is when I am trying to post a request to virtual service ,it is executing all the steps after the HTTP Responder step in a looping fashion.That means for 1 hit to VS ,I am getting multiple hits to the specified target URL continuously and it is not ending .So I need to stop the virtual service in VSE to end this.

     

    Can anyone provides any inputs.

     

    Please see attached word file for screenshots of VSM.

     

    Thanks

    Sarthak 

    Attachment(s)



  • 2.  Re: Virtual Service is going into a loop and getting executed continuously
    Best Answer

    Broadcom Employee
    Posted Mar 21, 2017 02:21 PM

    I see your VSM is customized and I think the VSM flow might be looping back. If you run the VSM in ITR then you know how the flow is working and you can correct it or you can open a support ticket and we can help you.



  • 3.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 22, 2017 04:07 AM

    Hi Prema,

     

    Can you please tell how I can manually run VSM in ITR mode.I am doing the below steps to achieve this:

    > Deploy the Virtual Service

    > Hit the Virtual Service URL with the request XML from any other WebService Execution Step

    > Run the VSM in ITR Mode.

     

    However the ITR mode is not running and giving any results.

     

    Thanks

    Sarthak



  • 4.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 21, 2017 03:20 PM

    Hi,  You have added web service step after http responder... and finally where your web service step is pointing ?  to LISTEN step ?

     

    Else try other way around have web service step before http responder.. so by default http responder will point to listen step.. 



  • 5.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 22, 2017 03:57 AM

    Hi Jagath,

     

    At the end my webservice step was pointing to Listen step only but then also I faced the same looping issue to I have put it to End the step but the issue didnt resolve even then.

     

    I cannot put the WebService step before the HTTP Responder step as I need to first send a synchronous response which I I have put in the VSI and then at the intervals of 10 seconds I need to send asynchronous response which I have put in WebService step.



  • 6.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 21, 2017 09:42 PM

    Maybe obvious, but you are not running your service in failover, learning, validating or tracking modes are you?  I find that learning, validating and tracking are often not extremely effective modes when trying to implement async processing such as yours. 

     

    As best I can tell from your screenshot, the only way to get into a repetitive loop is for one of the steps after the Responder step to loop to the first Parse Text as Response step following the Responder step.  However, your last WS step, 'Booked', just ends the VSM.  Is this ending intentional?  Normally, this step would loop to the Listen Step so the VSM can handle the next incoming request?

     

    Try the following: 

    Copy/paste the VSM under a different name.  

    Remove the Assertion branches related to learning, tracking and validating.  

    You do this by Right CLICKing on the Assertion in the step and select delete.  The idea is to simplify the model as much as possible to see if you can see the loop.  

    As gadpr08 indicated, try running your VSM in Single Step ITR mode.  Send a request from a client and watch the flow.



  • 7.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 22, 2017 06:21 AM

    Hi Joel,

     

    As suggested by you,I have removed all the assertions (learning,standing,tracking) and also to check I have removed the inclusion of live invocation step and live failure step so that The flow would be simple to debug.

    Still I see multiple responses sent (looping way).

    Please see updated vsm screenshot .(with todays date)

     

    Thanks

    Sarthak



  • 8.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 22, 2017 09:45 AM

    Strange, in the example you uploaded, there is no loop back onto one of the steps after the responder.  That is good.

    Can you execute the CopyOfOrderHW1.vsm service in ITR mode.

    When you send a request to the service, make sure the client is sending it to the IP address of the machine where you are executing in ITR mode.  Perhaps, use SoapUI or Postman to send the request that way you can do it all locally.

    If you single step through the VSM, when you get to the 'Booked' step and CLICK the next button, does the service go to the Responder step?

     

    If you open the VSM with Notepad++, you will see an XML representation of your VSM.

     

    Do a find on:   <Node name="Booked"

    A few attributes below that is an attribute that depicts the name of the step that will be executed when this step finishes (assuming it finishes successfully).

    The Attribute should contain: next="Virtual HTTPS Listener 8105" 

     

    DevTest uses these Attributes at runtime.



  • 9.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 22, 2017 10:30 AM

    Hi Joel,

     

    I have checked the Node name as "Booked" and the next step is the Listener step only.

     

    Next i am unable to test the vsm in ITR Mode.

    My Virtual Service URL is http://SWNC7R1205.kpnnl.local:8113/SV_OHhttp://SWNC7R1205.kpnnl.local:8110/AppleDep

     

    To Test in ITR I am using: http://172.18.91.60/SV_OH and passing the request XML with 172.18.91.60 as my machine IP Address.Then I am going to VSM and execute the ITR.But i am not able to get anything in ITR.I am getting Connection refused as response in the webservice execution step which I am using to hit the VS locally.

     

    Is this correct way of executing.

     

    Thanks

    Sarthak



  • 10.  Re: Virtual Service is going into a loop and getting executed continuously

    Broadcom Employee
    Posted Mar 22, 2017 11:14 AM

    Assuming the service listens on port 8113, you will need to send the request to http://172.18.91.60:8113/SV_OH from a client such as separate workstation, Postman etc



  • 11.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 30, 2017 10:53 AM

    Hi Joel/Prem,

     

    I have got the issue ,it was because of internal functionality which is like in request there is a parameter whose value can be either REQUEST/RESPONSE.Now because the system is continuously sending request back to virtual service so it seems like a loop.Now Basically I need to ignore certain type of requests to avoid the virtual service going to a loop and sending all responses again and again.

     

    Now I need to build a logic to read the value of this parameter everytime any request comes to virtual service and only if the value is REQUEST,I should send the synchronous & asynchronous responses but if the value is RESPONSE ,I should send only the synchronous response and not send anything else.Basically ignore the requests with RESPONSE value of this attribute.

     

    Can you please help me how can i build this logic.

     

    Thanks
    Sarthak



  • 12.  Re: Virtual Service is going into a loop and getting executed continuously

    Posted Mar 30, 2017 11:27 AM

    There are multiple ways to address this.  One approach is to add a Scripted Assertion in the Responder step. The assumption is that you know the correct name of the parsed incoming request argument so the accessor can locate it. Replace "yourKey" below with the incoming request element name containing a value of "Request" or "Response". If the consumer sends the value in different case, convert to upper or lower as appropriate when making the comparison.

    com.itko.lisa.util.ParameterList args = lisa_vse_request.getArguments();

    if ( args.containsKey("yourKey")  )

      if ( "Response".equals( args.get("yourKey")  ) ) 

           return true;

      else 

          return false;

    else

      // TODO: determine the branch action if the key is not on the incoming request

    Set the assertion to branch to the LISTEN step if it responds 'true'.

    If for some reason the request arguments are no longer in scope when the Assertion fires, you could perform the above check in a step prior to the Responder step and store the answer in a new property.  In the responder step, check this property value to determine the branch to take.

    Please pardon typos...



  • 13.  Re: Virtual Service is going into a loop and getting executed continuously

    Broadcom Employee
    Posted Mar 22, 2017 11:49 AM

    Can you please upload your MAR file Sarath?