Solved
Conclusion - Consuming REST API or Web Service from AEM
As far as i know, to the best of my knowledge a better implementation to consume a REST API or a Web Service API is to introduce a HTTPClient (Apache or Jersey Client or any Client). Very much like the post in
There is always a better way to do it, If there are two ways to make a choice,
Approach 1. Make JavaScript Ajax Calls to consume the REST API or WebServices
Approach 2. Use a HttpClient on the OSGI Service Layer to consume these services and may be use a mapper like jackson ObjectMapper to convert the JSON response to a POJO
I need to understand and/or convince my client that the second approach is a better approach for obvious reasons.
There is always a better way to do it, but in this case to the best of my knowledge the second approach seems to be more robust, since we can have better control on the code, better error handling, ObjectMapper Conversions, etc …… and if javascript needs some data there can be a call to a SlingServlet to feed the data.
Which one would you prefer ? Can you comment on this post giving some reasons advantages and disadvantages in Approach 1 or Approach 2so i can support my case. Your help is much appreciated.
-skullblower
