Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Masroor Khan
ServiceJSON error
December 18, 2008 2:30 AM
Answer

Masroor Khan

Rank: Regular Member

Posts: 119

Join Date: September 9, 2008

Recent Posts

I have written one method in servivice IMPL file for getting contact information, method is

public Contact getOwnerInfo(long userId) {
Contact contact = null;
try {

DetachedCriteria dCriteria = DetachedCriteria.forClass(Contact.class);
dCriteria.add(Restrictions.eq("userId", userId));
DynamicQuery dynamicQuery = new DynamicQueryImpl(dCriteria);
List list = ContactLocalServiceUtil.dynamicQuery(dynamicQuery, 0, 1);
if (Validator.isNotNull(list)) {
contact = (Contact) list.get(0);
}
} catch(Exception e){
e.printStackTrace();
}
return contact;
}


when i am calling this method from jsp


function ownerDetail() {

var params = {userId: '1011'}
Liferay.Service.Service.Bridge.getOwnerInfo(params, getOwner);
alert("after json ownerDetail")
}

function getOwner(data, status) {
alert(data + " " + status);
}


It is giving error is
15:21:20,348 ERROR [JSONServiceAction:126] Unsupported return type for class class com.mpower.inikah.common.service.http.BridgeServiceJSON and method getOwnerInfo




thanks in advance