Foros de discusión

JSON call to /assetentry/get-entries

Zenobia L, modificado hace 10 años.

JSON call to /assetentry/get-entries

Junior Member Mensajes: 28 Fecha de incorporación: 8/04/11 Mensajes recientes
Hello,

did anybody make a JSON call to "/assetentry/get-entries" ?
if yes, please post an example

its only parameter is "entryQuery" of type com.liferay.portlet.asset.service.persistence.AssetEntryQuery

I have tried first using the GUI for examples /api/jsonws
but no matter what I place in entryQuery (I tried to enter a string representation of an AssetEntryQuery, following JSONs guidelines)
I always get an error message

by debugging what is going on in the sever..
I can see that the programs don't even reach the part where they will pull what I have entered in the 'entryQuery' box
but it fails because there is no JSON 'converter' registered in Liferay for the AssetEntryQuery java class


   

Thank you

21:44:15,297 ERROR [http-bio-8080-exec-10][JSONWebServiceServiceAction:114] java.lang.ClassCastException: Unable to cast to type: com.liferay.portlet.asset.service.persistence.AssetEntryQuery

java.lang.ClassCastException: Unable to cast to type: com.liferay.portlet.asset.service.persistence.AssetEntryQuery

    at jodd.typeconverter.TypeConverterManagerBean.convertType(TypeConverterManagerBean.java:262)

    at jodd.typeconverter.TypeConverterManager.convertType(TypeConverterManager.java:58)

    at com.liferay.portal.jsonwebservice.JSONWebServiceActionImpl._prepareParameters(JSONWebServiceActionImpl.java:269)

 


Here is the source code for jodd.typeconverter.TypeConverterManagerBean ..
http://grepcode.com/file/repo1.maven.org/maven2/org.jodd/jodd/3.3.3/jodd/typeconverter/TypeConverterManagerBean.java

the converter is null and skips this logic, going straight where the exception is thrown

public <t> T convertType(Object value, Class<t> destinationType) {

208 TypeConverter converter = lookup(destinationType);
209
210 if (converter != null) {
211 try {
212 return (T) converter.convert(value);
213 } catch (TypeConversionException tcex) {


214 throw new ClassCastException("Unable to convert to type: " + destinationType.getName() + '\n' + tcex.toString());
215 }


</t></t>
Zenobia L, modificado hace 10 años.

RE: JSON call to /assetentry/get-entries

Junior Member Mensajes: 28 Fecha de incorporación: 8/04/11 Mensajes recientes
I found a way! emoticon

I'm using the "api/secure/jsonws/invoke", 6.1 GA2


	JSONObject _params = new JSONObject();
		
		_params.put("+entryQuery", "");
		_params.put("entryQuery.groupIds", 10415   );
		_params.put("entryQuery.allTagIds", 23330);
	
		
		 JSONObject _command = new JSONObject();
		  _command.put("/assetentry/get-entries", _params);

thumbnail
Quang Anh Ngô, modificado hace 8 años.

RE: JSON call to /assetentry/get-entries

New Member Mensajes: 4 Fecha de incorporación: 19/09/12 Mensajes recientes
Shit! I have to login to thank you.
You saved my day of work!

In my case, i use custom entity, and raw payload POST to url, so it will be:
{  
   "/CIS-portlet.webresponse_/test-xrx":{  
      "+param:com.fis.utilities.cis.model.impl.WebServiceResponse_Impl":"",
      "param.responseCode":"coin card",
      "param.responseMessage":"my"
   }
}