Flat file issue - Problem with the batch size in the Webmethod's java service


We have a specific requirement. Get all the flat files from the file server and perform some transformation and send the batch size of 200 records to Sales Force for upsert operation from each file. The problem is that the webmethod java service that split the size of the file takes the first file batch size and it keep the same batch size for the remaining files.

Attached find the Webmethod’s java service flow code. I really appreciate your help.


Java service flow code

package SAPProducts_Version01.Utilities;

import com.wm.data.*;
import com.wm.util.Values;
import com.wm.app.b2b.server.Service;
import com.wm.app.b2b.server.ServiceException;

public final class splitToBatches_SVC


 * The primary method for the Java service
 * @param pipeline
 *            The IData pipeline
 * @throws ServiceException
public static final void splitToBatches(IData pipeline) throws ServiceException {
	// pipeline
	IDataCursor pipelineCursor = pipeline.getCursor();
	// inList
	IData[]	inList = IDataUtil.getIDataArray( pipelineCursor, "inList" );		
	String	batchSize = IDataUtil.getString( pipelineCursor, "batchSize");
	if ( inList != null){
			int n = (int)Math.ceil(inList.length / Double.parseDouble(batchSize));
			IData[]	outList = new IData[n];
			int start = 0;
			int bs = Integer.parseInt(batchSize);
			for(int i=0; i<n; i++){	
				IData[]	batchList;
				if(inList.length > start + bs) {
					batchList = new IData[bs];
	            } else {
	            	batchList = new IData[inList.length - start];
	            	System.arraycopy(inList,start,batchList,0,inList.length - start);
	            start += bs;
	            outList[i] = IDataFactory.create();
	            IDataCursor outListCursor = outList[i].getCursor();
	            IDataUtil.put( outListCursor, "batchList", batchList );
			IDataUtil.put( pipelineCursor, "outList", outList );