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: JournalArticle WebServices
Hi all,
we need a web-service method for filtering articles depending on categories and display date. But we found nothing in the service (and in the FinderImpl-class).
What is the best way to do this in DXP? The only way I see is using extensions, like mentioned in https://help.liferay.com/hc/en-us/articles/360029030771-Introduction-to-Customization-with-Ext. Or ist it possible to create a service based on overwritten Liferay Services (ServiceWrappers)? But in both cases we need our own methods in JournalArticleFinderImpl, so what is the best way?
By the way we can NOT find the services for JournalArticle when browsing the default json webservices (api/jsonws) ! Any hints?
We are using DXP 7.2.10 GA1
Thank you for any information
we need a web-service method for filtering articles depending on categories and display date. But we found nothing in the service (and in the FinderImpl-class).
What is the best way to do this in DXP? The only way I see is using extensions, like mentioned in https://help.liferay.com/hc/en-us/articles/360029030771-Introduction-to-Customization-with-Ext. Or ist it possible to create a service based on overwritten Liferay Services (ServiceWrappers)? But in both cases we need our own methods in JournalArticleFinderImpl, so what is the best way?
By the way we can NOT find the services for JournalArticle when browsing the default json webservices (api/jsonws) ! Any hints?
We are using DXP 7.2.10 GA1
Thank you for any information
You may find such APIs among the Asset-related APIs and filter them down to JournalArticles.
With regards to creating additional APIs, I'd not go any ext route (from the help-center URL), but rather introduce a new and independent plugin (if you go that route): Nothing keeps you from adding a completely new API, rather than changing an existing one. Plus, you shouldn't change existing APIs anyway (and you can't).
If you go this way: You can either provide your own WS frontend, or go with ServiceBuilder. While ServiceBuilder seems to be organized around creating and persisting new entities: You can also leave the entities empty (no fields) and you'll end up with only the services, no persistent entities. That's a good way to introduce these APIs if you go through ServiceBuilder.
Of course, you can also choose to rather model along the headless-APIs.
In other words: You have options.
With regards to creating additional APIs, I'd not go any ext route (from the help-center URL), but rather introduce a new and independent plugin (if you go that route): Nothing keeps you from adding a completely new API, rather than changing an existing one. Plus, you shouldn't change existing APIs anyway (and you can't).
If you go this way: You can either provide your own WS frontend, or go with ServiceBuilder. While ServiceBuilder seems to be organized around creating and persisting new entities: You can also leave the entities empty (no fields) and you'll end up with only the services, no persistent entities. That's a good way to introduce these APIs if you go through ServiceBuilder.
Of course, you can also choose to rather model along the headless-APIs.
In other words: You have options.
Krzysztof Gołębiowski, modified 5 Years ago.
Liferay Master
Posts: 549
Join Date: 6/25/11
Recent Posts
In addition to what Olaf said, I'd definitely go with implementing custom Web Service (it is just one class) and implement the actual search with Fulltext index query rather than using default portal JournalArticle* services.
Thank you for your quick reply.
After introducing a new API and plugin with ServiceBuilder, we cannot see the parameters of the method in the WS-overview (api/jsonws). We see the method itself, but not the params of the method - only p_auth. Parameters are groupId, classNameId, ddmStructureKey, ...
When calling the service in a JSP with Liferay.Service('context.service/method) we get an exception - IllegalArgumentException.
But we can call the Method via Util-class in the JSP with the correct objects.
Do you have an idea?
Thank you
After introducing a new API and plugin with ServiceBuilder, we cannot see the parameters of the method in the WS-overview (api/jsonws). We see the method itself, but not the params of the method - only p_auth. Parameters are groupId, classNameId, ddmStructureKey, ...
When calling the service in a JSP with Liferay.Service('context.service/method) we get an exception - IllegalArgumentException.
But we can call the Method via Util-class in the JSP with the correct objects.
Do you have an idea?
Thank you
I haven't created a ServiceBuilder rest service in ages, just guessing here. Maybe annotations are missing? Did you try to rebuild the service? Check the interface in the api module, if the method is correct there.
I would just implement this as a jax-rs rest service. Create a new module project using the rest template and implement the interface. It is a bit tricky to get into it, but there are several threads in the forum already about the topic.
IMHO the added flexibility pays off.
I would just implement this as a jax-rs rest service. Create a new module project using the rest template and implement the interface. It is a bit tricky to get into it, but there are several threads in the forum already about the topic.
IMHO the added flexibility pays off.
Krzysztof Gołębiowski, modified 5 Years ago.
Liferay Master
Posts: 549
Join Date: 6/25/11
Recent Posts
I haven't done Service Builder for a while as well, but I remember that there was an additional action to be executed when building remote services - building WSDD. Currently, there is some Gradle plugin for that (https://help.liferay.com/hc/en-us/articles/360018161051-Creating-Remote-Services-) but I think in the past I had to execute ant or maven build-wsdd goal or something similar.
Hi all,
We found the problem, a IllegalArgumentException is thrown in MethodParametersResolverImpl, because the jodd-library can not handle JDK11!
See also https://liferay.dev/forums/-/message_boards/message/85190293.
Following in the build.gradle helped for us.
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
We found the problem, a IllegalArgumentException is thrown in MethodParametersResolverImpl, because the jodd-library can not handle JDK11!
See also https://liferay.dev/forums/-/message_boards/message/85190293.
Following in the build.gradle helped for us.
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
I have run into a Jodd/Java 11 issue too a while ago. I already thought about opening a bug for Liferay to upgrade Jodd, but since there exists no version that supports Java 11, it was a bit pointless.
We currently still use Java 8 for pretty much everything since we ran into issues several times.
We currently still use Java 8 for pretty much everything since we ran into issues several times.
Hi all,
after accessing the first method of the service successfully, we added another method with similar arguments in the XXXServiceImpl.java. After running the service builder we deployed the modules.
But now we get a NullPointerException in JSONWebServiceServiceAction. For both methods (when calling via api/jsonws or via Util-class in a JSP )!
We are using DXP 7.2.10 GA1 and also configured the service in the service access policy.
What can be the problem?
Thank you!
after accessing the first method of the service successfully, we added another method with similar arguments in the XXXServiceImpl.java. After running the service builder we deployed the modules.
But now we get a NullPointerException in JSONWebServiceServiceAction. For both methods (when calling via api/jsonws or via Util-class in a JSP )!
We are using DXP 7.2.10 GA1 and also configured the service in the service access policy.
What can be the problem?
Thank you!
Please try to set the log level of "com.liferay.portal.jsonwebservice.JSONWebServiceServiceAction" to debug, I believe you will get a better errormessage then.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™