Service Virtualization

  • 1.  Response is not returned from REST virtual service

    Posted Jun 07, 2017 01:40 PM

    Hello,

     

    I have created a REST based virtual service using request-response pair. In VSI, Operation name is not populated , it is displayed as <unknown-op>. When I am trying to hit this virtual service using REST step by using below URL -

    http://hostname:portno./

     

    and operation as POST. I am getting "404 not found" as response(which is generally returned for unknown requests).

     

    I think that this response is returned due to operation name is not available. 

     

    how to configure a REST base virtual service using RR pairs and how to send a request to REST based virtual service ?

    can anybody please help if I am missing something in REST service?

     

    Thanks



  • 2.  Re: Response is not returned from REST virtual service

    Posted Jun 07, 2017 02:09 PM

    '<Unknown Op>' is an indicator you are likely missing a configuration somewhere in the recording process. 

     

    Can you share an example of the R/R pairs you used to generate the service?

    Additionally, is the REST DPH included when you send the pairs through the recorder?  Check this by, CLICKing on filters in the VSM's LISTEN step.

    If REST DPH is included, is your payload Soap or XML-based? You may need to add a Request Data Manager DPH to prevent the XML parsers from overwriting the RESTful operation.



  • 3.  Re: Response is not returned from REST virtual service

    Posted Jun 14, 2017 02:53 AM

    After providing headers it worked



  • 4.  Re: Response is not returned from REST virtual service
    Best Answer

    Posted Jun 08, 2017 05:55 AM

    Hi,

    Hope your data protocol is JSON  then follow below step while creating the RR pairs

    in Request

    MethodName /BasePath 

    ex. GET /maps/api/distancematrix/json?origins=pune&destinations=hyderabad
    accept: application/json
    content-Type: application/json
    Connection: keep_Alive
    User-Agent: LISA  

     

    If method is PUT or POST then after 1 blank space paste the JSON content

     

    Response :-

    HTTP/1.1 200

    Response Body content

     

    then try to virtualized it. It will work.

     

    If you want to correct your current VSI then update the Operation name in VSI i.e. MethodName and BaseURL of your API and Deploy it. this should work.

     

    Attached the sample RR pairs for reference.  

    Attachment(s)

    zip
    googleapi-req.txt.zip   280 B 1 version
    zip
    googleapi-rsp.txt.zip   369 B 1 version


  • 5.  Re: Response is not returned from REST virtual service

    Posted Jun 14, 2017 02:52 AM

    Thanks for your reply. 

     

    Actually forget to put headers in the request . It worked after that