Forum Discussion

rahulverma3183's avatar
rahulverma3183
New Contributor
2 years ago

How to get Filed values from JSON Request in ServiceV

Folks,

I am working on ServiceV since few days .

It is very common scenario to fetch values from incoming request JSON and send the same in virtual response dynamically .

For ex: ORDERID

How can i achieve this ?

There is no property section at request side to do it in a click

2 Replies

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi,

     

    Where you have two services in a test, and you want to take a value from the first to use as parameter in the second; you have options.

     

    Property transfers are popular.  Have a look at the SmartBear docs.

    You can also use custom properties.  E.g. when the first call has ran, get the value of interest from the first service and save it as a custom property.  Then, in the second service, you can 'pull' the value from the custom properties.

     

    My preference is to 'pull' the value of interest from the first service into the second service.  In one of your services, right-click in the payload or params screen and click 'Get Data' from the mouse context menu.  This menu option is probably the most useful function when building test cases.  Have a look for Get Data in the docs as well as this forum.

    • rahulverma3183's avatar
      rahulverma3183
      New Contributor

      Hi Chris,

      This usecase is for service virtualization where i need to get field value from incoming request.

      When we virtualize a service there is no property transfer available , i belive that can be done only through script.

      VirtResponse step allows that  but a complex virtual service can't be create in Test.

      A proper seperate virtual service is the requirement