Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Tina Agrawal
JSON Service without service.xml
April 27, 2012 1:23 PM
Answer

Tina Agrawal

Rank: Expert

Posts: 261

Join Date: January 2, 2008

Recent Posts

Hi All,

Any clues how can we develop a Custom JSON Service in a portlet which lists down all the social activities.

We dont have a service.xml since internally the service will be invoking liferay services for retrieving activities.
From our portlet we want to invoke this Custom JSON Service through Ajax and display the result.

We dont want to use serveResource.


Regards,
Tina
David H Nebinger
RE: JSON Service without service.xml
April 27, 2012 1:34 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8583

Join Date: September 1, 2006

Recent Posts

That doesn't make any sense...

You want to expose a web service to make one of the Liferay APIs visible, yet you're going to invoke the web service from a portlet to get to the Liferay API?

Why not just access the service directly and skip the web service stuff?
Tina Agrawal
RE: JSON Service without service.xml
April 27, 2012 1:42 PM
Answer

Tina Agrawal

Rank: Expert

Posts: 261

Join Date: January 2, 2008

Recent Posts

Hi David,

To explain you - I want to display the list of all the activities for all the sites user is a member of in a dashboard.
Also I want to bypass the interpreter since I want to format the links that are shown.

Liferay doesnt have any API for doing that. And we dont want to use serveResource and directly invoke the service from JSP.

Is there any other way of doing it?

Tina
David H Nebinger
RE: JSON Service without service.xml
April 27, 2012 2:20 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8583

Join Date: September 1, 2006

Recent Posts

Well, for ajax support you'll typically issue a resource request to your portlet. The resource request handler should invoke the Liferay service to get whatever it needs, and it can then build the JSON result to return.