Paging records in the UI – Coding our own Web Service to get Row Numbers
This document is a continuation of Paging records in the UI, where we are modeling a Paging behavior for our application. As mentioned there, we might not be able to get from the Data Service the row number, necessary for the Paging:
In this case, we could achieve the same using a Web Service. Once we have the row number field we could model the paging behavior as before.
The UI is the same as in the old solution:
Creating a Web Service
For the detailed flow of creating the web service, follow the step in: Using Web Services in Visual Composer.
Just to give the general impression:
It starts in Visual Composer in NetWeaver Developer Studio, creating a Service Component with the ports we want the Web Service to have: the same as your “real” Data Service with the addition of the Row Number in the output port. Then we continue with Generate WSDL:
After several more technical steps we might write the following Java code, to define the behavior of our Web Service. Here we copy all the elements from input to output ports, adding the index number as an additional field:
There are still more steps like Deploying the Web Service on the server and defining it in NetWeaver Administator. Finally we can consume it in Visual Composer.
Using the Web Service in Visual Composer
- Find the Web Service the Search Panel.
- Add it to the model.
- Connect it after the “real” Data Service (here an R3 service).
- Edit Data Mappings as needed.
This is how it might look in the revised model:
A word about performance:
We do some extra copying of the data in this solution. However, we benefit from not overloading the UI.