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
how to Invoking JSON Web Services with Parameters
hi
i create a Rest service via service builder.
@AccessControlled(guestAccessEnabled = true)
@JSONWebService
public JSONObject feedback(String jsonInfo) throws SystemException, PortalException {
....
after deploy, the service can be found in api/jsonws
i try invoke the service, and because the jsonInfo is very long, i cannot pass it as part of url path.
i try pass it as object, Invoking-JSON-Web-Services#object-parameters
<form method="post" action="http://localhost:8080/api/jsonws/snm.record/feedback/+json-info">
<input type="hidden" name="+json-info" value="test"/>
<button type="submit" >submit</button>
</form>
the service be called, but jsonInfo always get empty.
and if without plus(+), it is missing.
{"exception":"Missing value for parameter json-info","throwable":"java.lang.IllegalArgumentException: Missing value for parameter json-info","error":{"message":"Missing value for parameter json-info","type":"java.lang.IllegalArgumentException"}}
i do not know what i missed, please help.
thanks in advance.
i solve this problem
the error is in name of hidden, it should as same as method, so it shuld be jsonInfo.
Powered by Liferay™