简体   繁体   English

Liferay JSON Web服务:URL访问不起作用?

[英]Liferay json web service: url access not working?

I am creating an Liferay 6.2 json web services. 我正在创建Liferay 6.2 json Web服务。 I created remote web service : 我创建了远程Web服务:

public String getUrl(String Urn) throws SystemException{
        String url = "";
        try{
            Urn urn = UrnLocalServiceUtil.getUrnsByUrnCode(Urn);
            return urn.getWholePath();
        }catch(NoSuchUrnException e){
            return url;
        }
    }

Webservice is working correctly if used from the web interface on : http://localhost:8080/api/jsonws/ 如果从以下网址上的Web界面使用Web服务,则Web服务将正常运行: http:// localhost:8080 / api / jsonws /

In tab result i get good and expected result. 在选项卡结果中,我得到了良好的预期结果。 When i click on tab "Url example" i get this url : " http://localhost:8080/api/jsonws/URN-portlet.urn/get-url/urn/URN%3ANBN%3ANBS%3ADSC%3A00000004 " but when i try to access it i get this message : 当我单击选项卡“网址示例”时,我得到以下网址:“ 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"} {“ exception”:“没有与// URN-portlet的路径/ urn / get-url和方法GET相关的JSON Web服务操作”}

What means the error obtained? 什么意思得到的错误?

The name of the portlet is URN-portlet.urn and the dot inside the name causes a wrong behavior. 该Portlet的名称为URN-portlet.urn ,名称中的点引起错误的行为。

Read the error message: 阅读错误消息:

path / urn /get-url and method GET for // URN-portlet 路径/ / get-url和方法GET // // URN-portlet

Change the name of the portlet with a better one. 用更好的名称更改portlet的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM