0
votes

I'm trying to build a jmeter (v2.12) test plan that will call a web service. I'm using SOAP/XML-RPC Request sampler in order to do it. But, one argument of the request must by dynamic, and I was thinking about using a JDBC PreProcessor.

I'm able to execute the soap request, it's working, but I'm not able to make it dynamic, passing values extracted from the jdbc preprocessor.

My test plan looks like:

Test Plan

The JDBC Connection Configuration looks like:

JDBC Connection Configuration

Then, I defined the JDBC PreProcessor as:

ldbc preprocessor

And finally my SOAP request looks like:

enter image description here

Notice that I modified the soap request and included the ${id}, but, When I run the test plan, my web service returns an error telling that Unmarshalling Error: For input string: "${id}". So, as you can see, jMeter did not replaced the variable with the return from the database.

So, my question is, how do I do this kind of test plan (dynamic soap/xml-rcp request with jdbc preprocessor)?

1
Did you try debugging (using a Debug Sampler) in order to see if the variable is set?Diego Villa

1 Answers

0
votes

As per User Manual

If the Variable Names list is provided, then for each row returned by a Select statement, the variables are set up with the value of the corresponding column (if a variable name is provided), and the count of rows is also set up. For example, if the Select statement returns 2 rows of 3 columns, and the variable list is A,,C, then the following variables will be set up:

A_#=2 (number of rows)
A_1=column 1, row 1
A_2=column 1, row 2
C_#=2 (number of rows)
C_1=column 3, row 1
C_2=column 3, row 2

So if your query returns a single number you need to use ${id_1} as your "dynamicfield" parameter

See The Real Secret to Building a Database Test Plan With JMeter guide for more details on how to properly perform database operations with Apache JMeter.