Data Source Correlation - Request Body

robbinsmkrobbinsmk Posts: 8

I am trying to use the Data Source Correlation Request body but the documentation in the help is limited and doesn't have any examples. Are there any examples on how I set up the xpath correctly for the JSON Request Body that the service is receiving? In my request I have three elements and I want to match on one of them and then in the Data Table the response will return with the rest of the data.

Comments

  • Ireneusz SzmigielIreneusz Szmigiel Posts: 150 ✭✭

    Hi robbinsmk

    in Virtualize User's manual you have whole section about it, see "Data Source Correlation Tab".
    The general idea is to select which column from data source should be used for corelation.
    Now if selected value from request ( by Xpath) is equal to value (particular row) from selected column then the rest of the row can be used to build response. You have to parametrize response with appropriate column names.

  • [Deleted User][Deleted User] Posts: 0

    Hi Robbinsmk,

    One easy step to miss is adding a sample request body to your JSON message responder before attempting to add data source correlation.

    To add a sample request, click on the "options" tab within your responder editor:

    Select "Request Template" on the left and then paste a sample JSON request into the "request message template for assisted XPath Creation" field:

    You can click the "tree" tab to make sure it parses correctly.

    Now that you've provided a sample request, you should be able to select the field(s) you want to use for data source correlation in the "Data Source Correlation" tab (if Add is grayed out, make sure you have added a data source already):

    How does this work? Well you can see in the screenshot above that I'm mapping a field in my incoming request to a column name in my data source (the column has the name "sampleID" in my example). Here is my data source:

    If the incoming request has a sampleID element with value 12345, then we correlate on row #3. If our response is parameterized against the "userName" field, then we will respond with the value "spencer"

  • [Deleted User][Deleted User] Posts: 0
    edited March 2017

    Let me know if you have any questions or issues.

Sign In or Register to comment.