Service Virtualization

 View Only
  • 1.  how to virtualise  application/x-www-form-urlencoded for Restful?

    Posted Aug 09, 2017 01:53 PM

    By using Rest step in application test we are getting reponse but when we are trying to virtualise the same request with application/x-www-form-urlencoded we are not seeing the arguments in the request of VSI.

    How can we get the arguments to apply the magic strings and do other customization

    VSI;- 

     



  • 2.  Re: how to virtualise  application/x-www-form-urlencoded for Restful?

    Posted Aug 10, 2017 04:18 AM

    How are you capturing the transaction in order to virtualise it? If you have example RR pairs that could be shared then it would help explain your question better



  • 3.  Re: how to virtualise  application/x-www-form-urlencoded for Restful?

    Posted Aug 10, 2017 08:27 AM

    +1 if you can post an example it will be helpful.

    Also, let us know which DPHs you are using in the VSM to parse the incoming request.

    You may need to extract the value side of shopInputDoJson into the request body before executing the JSON DPH to parse the args.



  • 4.  Re: how to virtualise  application/x-www-form-urlencoded for Restful?

    Broadcom Employee
    Posted Aug 10, 2017 09:47 AM

    Support case 00813495 opened for this.



  • 5.  Re: how to virtualise  application/x-www-form-urlencoded for Restful?
    Best Answer

    Posted Aug 10, 2017 02:05 PM

    Here is how it was resolved:

     

    The request payload is like the sample below:


    POST /value/value.action HTTP/1.1
    Content-Type: application/x-www-form-urlencoded

     

    shopInputDoJson={JSON payload}

     

    The Recorder, with the REST and JSON DPH, wasn't recognizing the JSON payload.
    To parse the JSON payload and recognize the arguments we used the following DPHs

    REST Data Protocol
    Delimited Text Data Protocol
    Request Data Manager
    JSON 2.0
    Request Data Manager

    No changes with the URL rules provided by the REST DPH.
    For the Delimited Text Request, selected the RegEx Matching Fields and provided \{.* - this would delimiter the JSON payload and create an argument (val1) with the request payload.
    For the first Request Data Manager, added an action to the Action List:

    Action = Move; Source Type = argument; Source Name = val1; Target Type = request body.

    After the JSON DPH is applied and JSON payload is parsed, we could use the second Request Data Manager and add two actions to the Action List:

    Action = Delete; Source Type = request body

    Action = Delete; Source Type = argument; Source Name = shopInputDoJson



  • 6.  Re: how to virtualise  application/x-www-form-urlencoded for Restful?

    Posted Aug 17, 2017 04:11 PM

    For clarity, the payload in the OP's use case is not a valid JSON payload format. It looks to be a name/key value pair where the name/key is "shopInputDoJson" and its value is the actual JSON payload. This is why the Delimited Text Data Protocol has to be used.