how to Invoking JSON Web Services with Parameters

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

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.

Scarletake Bwi, modified 3 Years ago. Expert Posts: 327 Join Date: 12/20/10 Recent Posts

i solve this problem

the error is in name of hidden, it should as same as method, so it shuld be jsonInfo.