我正在创建 Liferay 6.2 json Web 服务。我创建了远程 Web 服务:
public String getUrl(String Urn) throws SystemException{
String url = "";
try{
Urn urn = UrnLocalServiceUtil.getUrnsByUrnCode(Urn);
return urn.getWholePath();
}catch(NoSuchUrnException e){
return url;
}
}
如果从 Web 界面使用 Web 服务,则可以正常工作:http://localhost:8080/api/jsonws/
在选项卡结果中,我得到了良好的预期结果。当我单击“URL 示例”选项卡时,我得到以下 url: “http://localhost:8080/api/jsonws/URN-portlet.urn/get-url/urn/URN%3ANBN%3ANBS%3ADSC%3A00000004” 但当我尝试访问它时,我收到此消息:
{"exception":"No JSON web service action associated with path /urn/get-url and method GET for //URN-portlet"}
得到的错误是什么意思?
最佳答案
portlet 的名称是 URN-portlet.urn
,名称中的点会导致错误的行为。
阅读错误消息:
path /urn/get-url and method GET for //URN-portlet
将 portlet 的名称更改为更好的名称。
关于java - Liferay json网络服务: url access not working?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39512629/