掲示板

@JSONWebService annotation does not work ?

11年前 に adsfad asdfads によって更新されました。

@JSONWebService annotation does not work ?

New Member 投稿: 3 参加年月日: 11/01/15 最新の投稿
Hi,

i'm using liferay 6.1.2 ce-ga with Eclipse. I've tried to set up a json service on my custom portlet and followed the steps explained to build the service:

1. edit service.xml and set "remote-service=true"
2. add json to web.xml for scanning --> successfull
2. build services --> build successfull
3. annotation was added to service.class

Unfortunatly i am always redirected to following message when i try to call the service in the url:
http://localhost:8080/api/jsonws/test3-portlet/

{"exception":"No JSON web service action associated with path /test3-portlet/ and method GET for /"}

http://localhost:8080/test3-portlet/api/jsonws/ --> no resource found

Also when i call the url: http://localhost:8080/api/jsonws my service class does not appear with his methods.
Where can i found out if my service was scanned successfuly, it seems that the annotation does not work for me in that case or
do i forgot something ? any help will be very appriciated.

Thank you in advance.
11年前 に Gwowen Fu によって更新されました。

RE: @JSONWebService annotation does not work ?

Expert 投稿: 315 参加年月日: 10/12/27 最新の投稿
Have you generated your Java classes using ServiceBuilder?
11年前 に try out によって更新されました。

RE: @JSONWebService annotation does not work ?

New Member 投稿: 3 参加年月日: 11/01/15 最新の投稿
yes, java service class was generated with service - builder
11年前 に try out によって更新されました。

RE: @JSONWebService annotation does not work ?

New Member 投稿: 3 参加年月日: 11/01/15 最新の投稿
Hi,
i've found my mistake but if you read the documentation you would expect your service is exposed at:
http://localhost:8080/api/jsonws

but it will not !! So in my case the mistake was that i type in the wrong portlet name (case sensitive) to the url:

localhost:8080/<portlet-context>/api/jsonws

i always tried http://localhost:8080/test3-portlet/api/jsonws and this points me to the message "The requested resource was not found. "

Then i tried this one and it works: http://localhost:8080/Test3-portlet/api/jsonws (the url is case sensitive).

Annotation is working fine with @JSONWebService, so don't give up maybe it is the same issue described here.
hope this could help if someone is facing the same issue.