掲示板

Using JSON Web Service: How to pass object parameter

10年前 に Mohsin Siddiqui によって更新されました。

Using JSON Web Service: How to pass object parameter

New Member 投稿: 2 参加年月日: 13/12/16 最新の投稿
Hi,

I am trying to use JSON WS to search documents using following jsonws api:
http://localhost:8080/api/jsonws?signature=%2Fdlapp%2Fsearch-3-repositoryId-searchContext-query

It requires two objects as arguments:
1. SearchContext : com.liferay.portal.kernel.search.SearchContext
2. Query : com.liferay.portal.kernel.search.Query

I am unable to find a way to specify these parameters in calling this service from Javascript using Liferay.Service() method.
Liferay.Service(
'/dlapp/search',
{
repositoryId: 10184,
searchContext: , // <-- how to pass arguments here
query: // <-- how to pass arguments here
},
function(obj) {
console.log(obj);
}

I tried to create a json structure based on java source but to no avail.

Thanks,
Mohsin
thumbnail
8年前 に Denis Signoretto によって更新されました。

RE: Using JSON Web Service: How to pass object parameter

Expert 投稿: 375 参加年月日: 09/04/21 最新の投稿
Hi Mohsin,

in some cases sending a JSON object for an object parameter doesn't work due to JSON deserialization. To send a JSON Object like serviceContext or searchContext you need to send it populating its inner parameters explicitly as described here.

HTH,

Regards,
Denis.
6年前 に yuyuan wang によって更新されました。

RE: Using JSON Web Service: How to pass object parameter

New Member 投稿: 4 参加年月日: 17/03/31 最新の投稿
It is a long time.
I want to do this too,fortunately successed.
this is my way