We are on Pega 7.1.8 and trying to consume REST Service through the wizard.
As part of consumption, I have provided the service output in XML format.( I observed that its not generating the response data model without providing the sample response)
I have also selected the Generate Data Layer as option.
After the consumption is complete, we observe that there were some classes and data model created under the data layer for response data mapping.Why is it happening this way ?
Why can't the data layer has a reference Object ( a page of type Int- like response_GET page created in Int Layer) in the data layer instead of creating the classes.That way we don't have to create the additional classes and data model under Data- Layer,which would avoid the overhead of maintenance of making changes in both the layers.( if there is an attribute change)
Pega creates the classes and properties based on your payload structure. As it is a wizard, it is not sophisticated enough to think like humans to promote re-usability. It just creates the structure as-is and doesn't look into anything else. Let's hope Pega enhances the wizard to minimize the number of rules created by looking in inheritance path for re-usable rules.
It isn't a Pega best practice for data pages to hold objects of Int-* classes. The data layer is meant to act as a layer of data source abstraction for the application layer. The whole idea is, in future, you should be able to easily swap out REST connector as your data source for any other data source without disturbing your application layer.
If you are only interested in a subset of REST response data, I suggest you skip creating the data layer through the wizard and create your data layer data model manually and modify response data transform to map only the data you need.