Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Failed to respond to incoming message using data source row correlation

RexArun
RexArun Posts: 5

I have a request i.e. "crn":"234567890123456","amount":"200","settlementDate":"20091224", and a responder using a data source correlation of several response. And the response is to send the responseCode by validating the "amount" [<250] or [>250].

When I send a request via a Parasoft Virtualize .pva file the event monitoring returns error "Failed to respond to incoming message using data source row correlation. Values incoming message did not match values in the data source. "Message has no content".

Answers

  • williammccusker
    williammccusker Posts: 689 ✭✭✭

    Hi,

    What content-type is the request message? From the snippet it appears to be json? Is a JSON Responder being used?

  • RexArun
    RexArun Posts: 5

    Hi William,

    Thanks for your response, yes the request message is JSON and I'm using the JSON message responder for that.

    And I'm using the table Datasource and map it in DataSource Correlation using Request Body.

  • williammccusker
    williammccusker Posts: 689 ✭✭✭

    Hi Rex,

    Based on the error message the responder thinks the request payload was empty. What does the event monitor show? Event Monitoring can be be turned on by right clicking on the Virtual Asset in the Server View, and selecting the "Start Monitoring" action. The details can be seen in the "Parasoft Event Details" perspective. The details will show what message the responder received and its response.

    Are there any errors reported to the details when the request message is sent to the virtual asset? If you could share some information from what you see in the Event Details it would help.

    Also, if you're really stuck and need someone to assist you in a more hands-on capacity then I would recommend contacting Parasoft Support for help.

  • RexArun
    RexArun Posts: 5

    Hi William,

    Attaching my Parasoft Event Details, for request received and response sent

  • williammccusker
    williammccusker Posts: 689 ✭✭✭
    edited January 2022

    Hi,

    This is an interesting request, it seems that the json payload is actually inside of a query? It's not even in a query parameter? This is the first line of the request

    POST /api/ValBillerDts?{"payments":[{"tid":"1","payment":{"billerCode"...

    The correlation being used is applied to the body of the HTTP request, which in this case is empty. Is the JSON payload supposed to be part of the query in the URL?

  • RexArun
    RexArun Posts: 5

    Hi,

    Thanks William, it's very useful information and I'm in talks with my team regarding this request format.

    Is there any way..??, that I can still map this request in my Datasource Correlation.

  • williammccusker
    williammccusker Posts: 689 ✭✭✭

    Hi,

    It can be done but it will mean a script is needed to extract the JSON from the URL string. I attached an example responder for a simple case where the JSON payload and request line looks like this,

    POST /jsonQuery?{"key":"hello"}

    I configured a JSON Responder by going to

    Options > Request Handling > Allow incoming request tools to modify the message before applying data source or multiple response correlations

    Then in an Extension Tool attached to the "Incoming Transport Header" I used this script to extract the json from the URL. In my case I noticed the first line was reported by the Extension Tool had an equals, =, sign appened to the end of the JSON. I am not sure why since I didn't add it so in your case you may need to use something different to find the end of the JSON in the first line.

    import com.parasoft.api.Application
    def extract(input, context) {
    text = input.getText()
    Application.showMessage(text)
    
    multiline = '' + text
    list = multiline.readLines()
    firstLine = list[0]
    Application.showMessage("firstLine=" + firstLine)
    json = firstLine.substring(firstLine.indexOf("?")+1, firstLine.lastIndexOf("="))
    Application.showMessage("json=" + json)
    return json
    }
    

    Hope this helps!

  • RexArun
    RexArun Posts: 5

    Hi William,

    Thank you very much for your support, This method using (Incoming Transport Header-Extension Tool) is working fine with my request.

  • williammccusker
    williammccusker Posts: 689 ✭✭✭

    Glad it worked!

  • sksamdani
    sksamdani Posts: 3
    edited April 15

    Can you please suggest me on the below request how to proceed. I am sending a parameter in the request URL like this http://localhost:9080/Methodname/{cardnumber}/pvaname. The cardnumber will be dynamically passed to the responder. I tried to implement this I am getting different errors not getting the respective response. What are the steps needs to follow and how to implement to get the respective API JSON response. Thanks.

    sample URL: http://localhost:9080/Methodname/12345678/pvaname. cardnumber will be changes based on the request but the response should be static.

    When I hit the above request url from browser need to get the response as below,

    {
    "response" :: {
    "statusmessage" : "Success"
    }
    }

  • williammccusker
    williammccusker Posts: 689 ✭✭✭

    Hi,

    It sounds like you want to set up a Data Source Correlation using the Request HTTP URL Paths. I've attached a sample PVA file that shows how to get the card number from the path and match it to a value in a data source. Take a look at "Json Message Responder" > Data Source Correlation > Request HTTP URL Paths. I also set a sample request URL in the options that helps make the selection of path parameters for correlation easier. The PVA file was created using 2024.2, so you need that version of Virtualize to open it.

    Hope this helps!

  • sksamdani
    sksamdani Posts: 3
    edited April 16

    Thanks William for your immediate response. I am new to this Parasoft.

    I am unable to open this PVA in 2023. I don't have license for 2024 what ever the license I have is for 2023. Is it possible to send this PVA in version 2023.

    I am using version 2023. But the card number will be coming dynamically in request so we don't know the card numbers to store in data source. Is it possible to run PVA without comparing card number from the path with data source? because we are not using this card number anymore in the PVA just wanted to run the PVA with dynamic card number in the path. Below is the requirement.

    1. When I use (Application) browser to hit the PVA using request URL path (http://localhost:9080/Methodname/{cardnumber}/pvaname).

    2. Application (Browser) will send the card number dynamically in the request URL to the PVA and the PVA will receive the the card number in the URL.
      ex: http://localhost:9080/Methodname/1234567/pvaname

    3. Static Response already created for all the respective API's in the PVA (Response will be same for any of the card number).

    4. Wanted to hit the PVA with dynamic card number, irrespective of card number need to get the defined static response.

    1. In my case Here one PVA will have multiple API's (Responder suites) due to the path already defined in the application, based on that we are creating PVA.

    ex; total 20 API's in 5 PVA's
    1. Account.pva
    . AcctInq
    - BalanceInq
    - Rs 3
    - Rs 4
    - Rs 5
    2. MoveMoney.pva
    - Transfer
    - CustPayeeInq
    - Rs 3
    - Rs 4
    - Rs 5
    etc..

    I struck up here. Please help me on this William.

  • sksamdani
    sksamdani Posts: 3

    Hi William, As suggested above do we need to enable correlation for "Response Correlation" > "HTTP URL Path"? If we disable HTTP URL Path correlation the 2nd API is showing 1st API response. Can you pls suggest what need to be done and what are the correlation we need to enable to run PVA successfully. Thanks.

  • williammccusker
    williammccusker Posts: 689 ✭✭✭

    Hi,

    It sounds like you want to enable the URL Path and set something like this as the Path to match "/*/pvaname" where the * takes the places of the dynamic cardnumber in the path. This will match any cardnumber in the path and then you should get the static response.

    Hope this helps!