Outbounde Exception the second time that I try to read an Excel with SoapUI
Really, I would not need anything of xml, it is just the code that I found for reading datas from an Excel. Now I got this new one that is better.
I need this because I should send messages of vehicles that has some of their fields with just some allowed values, for example, odometer unit: Milles, Hours or Kilometres. Then, I would like to put all those values in an excel and take them for each message (I should send the same number of messages as possible values).
Thanks you and best regards.
There is simple way to achieve the same differently.
Create a .csv file for valid values for odometer as shown below:
odometer.csv - contents of the file
For more details about xlson library, visit github
Here is the script which reads the above csv file and selects one of values randomly
import static com.xlson.groovycsv.CsvParser.parseCsv //Provide the file path of odometer csv def data = parseCsv(new File('/tmp/odometer.csv').text) def odometerUnits = data*.values.flatten() //Randomly selects def selectedValue = odometerUnits[new Random().nextInt(odometerUnits.size())] log.info "Current selection: $selectedValue"