我使用 Liferay 6.2 我使用 Service Builder 创建一个实体 (notizia)。
我生成了 Web 服务。 我有一个打印字符串的方法,如下所示:
public class notiziaServiceImpl extends notiziaServiceBaseImpl {
@Override
@AccessControlled(guestAccessEnabled=true)
public String printMyString()
{
return "i'm the string ";
}
}
它有效! 我添加了另一个带有输入参数的方法
@AccessControlled(guestAccessEnabled=true)
public String getHelloWorld(String worldName)
throws com.liferay.portal.kernel.exception.PortalException,
com.liferay.portal.kernel.exception.SystemException {
return "Hello world: " + worldName;
}
“getHelloWorld”方法不起作用。 我在控制台中收到此错误:
[MethodParametersResolverImpl:59] java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
我不知道我错过了什么。 我该如何解决?
最佳答案
当您向 XxxServiceImpl 类添加新方法时,您始终必须重建服务。
ServiceBuilder 将正确的内容注入(inject)到父类等中,以确保该方法已注册并可用于远程 API 调用。
关于java - Liferay Json Web服务参数输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51523136/