How to handle a web service response that uses pagination to divide the number of records in its result set.
In the initial response you get from the web service, save the values of the fields that have TotalPages and the PageIndex in global variables. You need to do this in mapping.
1. In this example the web service response on the left has fields such as totalPages and pageIndex.
We create global variables where we set these two values in the context by using the set-context function. See example below. Refer to Help on how to create Global variables in mapper.
2. In the Process design, build a flow that has a decision node and activities as shown in the attached image.
3. Double click on the arrow labeled No and click on Edit button in the properties panel and use this logic in ‘Java condition’.
4. Now in the “Get the next page result” step you need to set the request where you get the data from next page.
StringBuffer buffer = new StringBuffer();
int index=Integer.parseInt(context.get("pageIndex")); >>>> this page index is pageindex+1 as done in the global variable of the previous map.
5. Rest of the steps are same as the flow before the decision node.
Article is closed for comments.