Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Screenlet and Portlet Web Service
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,
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.
Powered by Liferay™