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.

Datasource Correlation

reactancexl
reactancexl Posts: 176

I am using a database correlation datasource for my responder. The query in DS is Execute procName :queryParameter. (returns col named "payload") I have a groovy script chained to the responder which grabs the query parameters and values from the request. The issue I am having is: How do override the "query Parameters" in data source correlation? It expects the names originally passed in from client. I keep getting [Parasoft Exclude] which means nothing is getting pass to the stored proc. Suggestions?

Tagged:

Answers

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,

    Normally database data sources would execute their query before the correlation step. So you'll need to use the "Database Correlation" data source which is specifically for those cases when a value from the request needs to be used as part of the database query during correlation.

    Make sure you're using the "Database Correlation" data source and not the "Database" data source.

    Here is the documentation for the Database Correlation data source
    https://docs.parasoft.com/display/SOAVIRT20241/_Adding+a+Data+Source+at+the+Suite,+Project,+or+Global+Level#id-_AddingaDataSourceattheSuite,Project,orGlobalLevel-ConfiguringaDatabaseCorrelationDataSourceConfiguringaDatabaseCorrelationDataSource

  • reactancexl
    reactancexl Posts: 176

    Thanks Bill for the response. I am using the database correlation. What I have is query strings stored into a DB table to get payload. The query string would be in a variable. For instance size=100&policy=000987. I have this value assigned to a variable to be passed into a stored procedure. But how do I get it to match on the data source correlation tab. The Name works only on the original client query params. I need it to see the new query param that is assigned. Not sure if this is even feasible. thx

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,

    So you have a tool attached to the incoming request to extract the query parameters into a variable, correct? If that's the case you should be able to reference those variables using the :variableName syntax in the database correlation data source.

    Where did you attach the tool that is extracting the query parameters into variables? It needs to happen before the correlation step so depending on what version of Virtualize you have there is either the setting in Responder > Options > Request Handling, "Allowing incoming requests tools..." that may need to be enabled or the tool might be able to be added to the "Pre-correlation Incoming Request" output.

    Could you let me know what version of Virtualize you have? Would you be able to share an example of your pva file?

  • reactancexl
    reactancexl Posts: 176

    version 2023.2. Attahced are screenshots of my pva. The variable in the text databank has a value of "size=100policy-id=0004175675" This is what I want to send to the stored proc

  • reactancexl
    reactancexl Posts: 176
    edited September 29

    I took another approach to this. I chained a rest client to the responder in which I wrote a service to grab the query String and called the stored procedure passing in the query params. Chained a Databank to get the resultset to a variable. Used that variable in the "Response tab" in the responder. There is No Correlation associated with this. thx

  • reactancexl
    reactancexl Posts: 176

    Update forgot to mention their is a databank preceding the Rest call to capture the querystring which is pass in to the service

  • williammccusker
    williammccusker Posts: 672 ✭✭✭

    Hi,

    It sounds like you found a solution? I didn't see any screenshots attached but if you found something that works that's great!

  • reactancexl
    reactancexl Posts: 176
    edited October 1

    I simplified this even more. I eliminated the service, so now in my chain of the responder I have Text DB(gets the queryString to variable) >>DB Tool calling stored Proc with the Variable as the parameter >>XML Databank to capture the value to variable >>set responder to DS with XMLdb variable. No correlations needed on the tabs.