Service Virtualization

  • 1.  REST GET call virutalization throwing error in Devtest 10.1

    Posted Jun 15, 2018 04:03 AM

    I am trying to create a virtual  service for a REST GET operation.

    I have used RR pair to create the same in Devtest 10.1.0 workstation. When I am trying to do a hit on the VS from SOAP UI the following error is encountered. Please suggest what needs to be done to fix the issue. Also could you please suggest the content type to be used for getting correct response as there are URL contents in it.

     

    <html>
       <head>
          <meta content="HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org" name="generator"/>
          <title>404 Not Found</title>
       </head>
       <body>
          <h1>Not Found</h1>
          The requested URL /rest/ofscCore/v1/events?subscriptionId=xxxxyyyyzzzz&amp;page=123456-1235%2C0 was not found on this server.
          <hr/>
       </body>
    </html>

     

    Request file:

    GET /rest/ofscCore/v1/events?subscriptionId=xxxxyyyyzzzz&page=123456-1235,0

     

    Response file:

    {
        "found": true,
        "nextPage": "123456-1245,0",
        "items": [],
        "links": [
            {
                "rel": "describedby",
                "href": "https://sample.com/rest/ofscCore/v1/metadata-catalog/events"
            },
            {
                "rel": "canonical",
                "href": "https://sample.com/rest/ofscCore/v1/events/?subscriptionId=xxxxyyyyzzzz&page=123456-1235,0"
            },
            {
                "rel": "next",
                "href": "https://sample.com/rest/ofscCore/v1/events/?subscriptionId=xxxxyyyyzzzz&page=123456-1245,0"
            }
        ]
    }



  • 2.  Re: REST GET call virutalization throwing error in Devtest 10.1

    Broadcom Employee
    Posted Jun 15, 2018 10:09 AM

    You get 404 message when the VS doesn't have the transaction in VSI. Can you verify the VSI and see it has transaction with the operation /rest/ofscCore/v1/events and Request Data has the arguments "subscriptionId" and "page"?

     

    If you can't resolve, open a support case or share the VSM and VSI



  • 3.  Re: REST GET call virutalization throwing error in Devtest 10.1

    Posted Jun 18, 2018 02:46 AM

    Hi Prema,

     

    Thanks for the reply. The request does contain the necessary operation name and the the arguments "subscriptionId" and "page".

    I will raise a case for this issue as the VSI and VSM contains details which are confidential.

     

    Thanks,

    Sourav.



  • 4.  Re: REST GET call virutalization throwing error in Devtest 10.1
    Best Answer

    Posted Jun 18, 2018 04:37 AM

    Hi Sourav,

     

    Thank you for raising the case - I have taken a look.

     

    The problem is that your request in the RR pair contains a comma, which is a RESERVED character, and must be encoded when appearing in a query string.

     

    So, a query string of the form:

    GET /rest/ofscCore/v1/events?subscriptionId=xxxxyyyyzzzz&page=123456-1235,0

    is not correct since the comma has not been encoded.

     

    The corrected version of this string would be:

    GET /rest/ofscCore/v1/events?subscriptionId=xxxxyyyyzzzz&page=123456-1235%2C0

    This string is what SOAPUI will send, as evidenced by your error message - the error is therefore expected, and correct, behaviour.

     

    The question now becomes what you will REALLY be sent from the system invoking the service. If you have a comma in plain, then the service, as recorded, should suffice.

     

    If you are being sent an encoded comma, as per the standard, then try re-recording with the corrected string as per above.

     

    If you wish to cater for both events, the try recording with two RR pairs, one for each of the two request forms.

     

    Dave.



  • 5.  Re: REST GET call virutalization throwing error in Devtest 10.1

    Posted Jun 19, 2018 03:32 AM

    Hi David,

     

    Thanks for the suggestions, I have added two RR pairs but the identified transaction stays single as "page" is treated as an argument, so the value of argument page changing from "," to "%2C" does not really creates a new transaction.

     

    Also, I tried out using postman but even then the same error got reproduced.
    Anything else we can try here, may be some header parameters.

     

    Please let me know if any information is required from my end.

     

    Thanks,
    Sourav.