Submit and vote on feature ideas.

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

Options
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: 643 ✭✭✭
    Options

    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
    Options

    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: 643 ✭✭✭
    Options

    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
    Options

    Hi William,

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

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    edited January 2022
    Options

    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
    Options

    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: 643 ✭✭✭
    Options

    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
    Options

    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: 643 ✭✭✭
    Options

    Glad it worked!