Expand my Community achievements bar.

SOLVED

Store and retrieve json data

Avatar

Former Community Member

Hi All,

I am new to AEM,

I want to know how to store and edit a json data(a simple json array contains a list of accounts) in AEM.

And also how to retrieve it by using a web service so that my web and mobile apps can use this data.

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Level 10

AEM does not support exposing a SOAP based web service (you can consume a 3rd party SOAP web service - not expose one). 

However - you can write an AEM Sling Servlet that then you can invoke it using REST requests. For example  - a GET. Now for working with JSON in AEM, You can write a Sling Servlet and use JSON libs - such as the Simple JSON lib:

https://code.google.com/p/json-simple/

THis shows invoking a sling servlet from an AEM page - but you can invoke from outside of AEM too and the servlet returns the JSON data. 

To learn how to write a SLing Servlet that uses the simple JSON (including how to bundle that into an OSGi) -- see this community article: 

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

PS - you placed this thread in the communites forum (meant for AEM Communities questions) - next time - please place AEM related questions in the main AEM forum. 

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

AEM does not support exposing a SOAP based web service (you can consume a 3rd party SOAP web service - not expose one). 

However - you can write an AEM Sling Servlet that then you can invoke it using REST requests. For example  - a GET. Now for working with JSON in AEM, You can write a Sling Servlet and use JSON libs - such as the Simple JSON lib:

https://code.google.com/p/json-simple/

THis shows invoking a sling servlet from an AEM page - but you can invoke from outside of AEM too and the servlet returns the JSON data. 

To learn how to write a SLing Servlet that uses the simple JSON (including how to bundle that into an OSGi) -- see this community article: 

https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html

PS - you placed this thread in the communites forum (meant for AEM Communities questions) - next time - please place AEM related questions in the main AEM forum.