Message Boards

Screenlet and Portlet Web Service

Serge Byishimo, modified 2 Years ago.

Screenlet and Portlet Web Service

New Member Posts: 5 Join Date: 5/13/21 Recent Posts

Hello Liferay Community,

What ways to make a screenlet interact with a portlet to get custom data the screenlet needs?

JSON service builder web services are not what I'm looking for because it returns database entities, and it is not my case, instead, I'm returning custom data processed in a portlet and I want the mobile screenlet to access that data.

Kindy, recommend technologies to use! I saw something called "JAX-WS and JAX-RS" and I don't know if it can help (https://help.liferay.com/hc/en-us/articles/360018161171-JAX-WS-and-JAX-RS)

Anything would be appreciated!

Best Regards,

thumbnail
Olaf Kock, modified 2 Years ago.

RE: Screenlet and Portlet Web Service

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

You can go with ServiceBuilder's JSON Web Services, they're not limited to database entities. You'd have to push down your implementation from the portlet layer to the business layer though (which might be a good way to separate UI (portlet) from business code.

Another option is to go the "Headless" route, which provides proper REST services, but again, you'd not implement them in your portlet, but would push out the implementation to a different layer.

Lastly, if you insist on keeping the logic within your portlet, you can use a portlet's resourceURL, which accepts and generates arbitrary data, types and formats, but you'll have to handle quite a bit of the serializing/deserializing yourself that you'd get for free if you would use one of the service techniques.