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
Service builder generates *Soap.java files, but none for JSON.
Should it? Obviously, all my entities have remote-access="true". I even tried setting the implied attribute json-enabled="true".
I've added JSON servlet definitions to web.xml.
I just cannot get scanning for JSON api methods to happen when I deploy.
Any help would be greatly appreciated.
I've added JSON servlet definitions to web.xml.
I just cannot get scanning for JSON api methods to happen when I deploy.
Any help would be greatly appreciated.
For me it generates the *JSONSerializer.java files when service is built.
version: Liferay 6.0
Can you share your web.xml and service.xml files.
version: Liferay 6.0
Can you share your web.xml and service.xml files.
Hi Gerald Rubin
i have the same problem, did you find the solution , if can you please help me in that.
Thanks
i have the same problem, did you find the solution , if can you please help me in that.
Thanks
gatla1 chinna:
Hi Gerald Rubin
i have the same problem, did you find the solution , if can you please help me in that.
Thanks
Let me tell you what I've done now.
My service.xml creates about 30 entities, but I really want custom methods exposed for JSON queries. So, I created a Database-portlet and put the service.xml into it. All entiies are marked local only, not remote. I build, deploy, handle the tables, etc. normally. I move the Database-portlet-service.jar to \tomcat\lib\ext. All other portlet project have this jar in their build classpath. This portlet is NEVER meant to be added to a web page.
Neither is this one: JSON_wrapper-portlet. It has a service.xml which Liferay generated with the sample Foo class--marked as remote. I did a build service.
Then I opened ...FooServiceImpl.java and added all the JSON methods I wrote and want to expose there. You have complete access to the real database jar and any custom classes you need. All your work goes into this Impl. My methods return either database entities or Object[] (if I'm returning an array of entities--database or my own). I have not been able to JSON serialize a complex custom class.
After adding methods to FooServiceImpl.java I build the service again; clean; compile; and deploy. That service.jar stays right in the webapp.
If I browse to http://localhost:8080/json_wrapper-portlet/api/jsonws, I see all my custom methods. I can test them right there. (In Internet Explorer the JSON response wants to download, but the other browsers just display it.)
I'm in Liferay 6.1. If you're in 6.0.x, I think you have tunnel-web someplace in the URL, but I did everything under 6.1.
It works fine. I hope this help.
Jerry