If you just want to use the FlatFileItemWriter on its own, you can do that by passing your list to the write() method:
Code:
writer.setResource(new FileSystemResource(outputFile));
writer.setLineAggregator(someLineAggregator);
writer.open(new ExecutionContext());
writer.write(myList);
writer.close();
If you want to do it in a "batch processing" way, then you can configure a batch job that uses a ListItemReader and a FlatFileItemWriter. You can do the webservice calls from within the ItemReader by creating a custom wrapper to the ListItemReader:
Code:
public class MyItemReader<MyItemType> extends ItemStreamSupport implements ItemReader<MyItemType> {
private ItemReader listItemReader = null;
public void open(ExecutionContext executionContext) throws ItemStreamException {
List<MyItemType> webserviceData = getListFromWebservices();
this.listItemReader = new ListItemReader(webserviceData);
}
public MyItemType read() {
return this.listItemReader.read();
}
}