Expand my Community achievements bar.

Using JSONWriter objects to display Adobe CQ OSGi data

Avatar

Level 9

Hi All,

In this article https://helpx.adobe.com/experience-manager/using/using-jsonwriter-objects-display-cq.html , it says "lookup.json.jsp: contains application logic that creates a JSONWriter object and calls the OSGI bundle operations. This file is the connection between a JSP front end and the back end OSGi operations. "

1] But we have not created any bundle anywhere in this article and I guess, there is no OOTB bundle also provided that returns weather information. What exactly is the bundle being referred to here?

5 Replies

Avatar

Level 10

Hi,

If you take a close look up, you may noticed import="org.apache.sling.commons.json.io.*,com.cdyne.ws.weatherws.*",

and Weather ww = new com.cdyne.ws.weatherws.Weather(); where this api is used

Avatar

Level 9

Hi Edubey,

Thank you for your reply.

My bad, there is another article https://helpx.adobe.com/experience-manager/using/creating-cq-bundles-consume-web.html wherein the complete details are provided. Looks like some wsdl files were provided which were converted to java proxy classes which in turn were converted to a bundle and deployed into the server.

Also, one more doubt I have in https://helpx.adobe.com/experience-manager/using/using-jsonwriter-objects-display-cq.html article in templateJSON.jsp file is

- Why are we using the line var url = location.pathname.replace(".html", "/_jcr_content.lookup.json") + "?zip="+myZip, not able to understand.

- success: function(rawData, status, xhr) , not able to understand from where are these parameters coming.

Avatar

Level 10

1. lookup.json is the file where we have our actual business logic to get weather data. we pass Zip code to this file via query string parameter zip="+myZip and captures it via String zip = request.getParameter("zip"); in lookup jsp

2. This is something which is not related to AEM rather it is jQuery. When you make a your Ajax request is successful success method gets call with these parameters. value of these comes from response object which you need not take care. Take a deep look up documentation @ http://api.jquery.com/jquery.ajax/

Avatar

Administrator

Hi

This article is using "soap web service" for more information on SOAP see : http://www.javatpoint.com/soap-web-services.

It is 

  • SOAP stands for Simple Object Access Protocol
  • SOAP is an XML based protocol for accessing Web Services.
  • SOAP is based on XML
  • SOAP is a W3C recommendation

You can consider it as third party functions available that give you results (likewise RESTful APIs dose).

//wr.getCity() result is response.

I hope this would help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 10

If you look at this start of the article:

You will see:

To follow along with this development article, create the OSGi bundle that consumes the third-party web service by following the article referenced in the previous link.