【问题标题】:Liferay web serviceLiferay 网络服务
【发布时间】:2013-03-18 23:18:07
【问题描述】:

我使用与 Tomcat 服务器和 Oracle 10g 数据库捆绑的 Liferay 6.1.1-ce-ga2。 我的目标是插入一些内容,作为期刊文章,并将它们显示在 Asset Publisher 中(具有结构和模板,已经可以使用)。

我使用JournalArticleServiceSoap.addArticle(...) 和正确的字段(groupid, structureid, templateid, ...)。内容已“正确”插入数据库中,我可以在管理员内容面板的 Web 内容中看到它们。内容也有"Approved" 作为状态。这是通过设置来完成的:

serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH)

但是,我无法看到插入的内容与 Asset Publisher 中的其他内容一起显示,直到我再次打开它进行编辑并单击发布按钮(即使没有进行任何更改)。然后按预期发布内容。问题是内容的数量。它大约是 600,所以我无法为每个人执行此操作。

我不明白这是怎么回事以及如何解决?换句话说,我要怎么做才能让 Web 服务插入的 Web 内容自动显示在 Asset Publisher 中?

或者,"Publish" 究竟做了什么,以便我可以尝试使用 SOAP 服务(或插入后的 SQL)以编程方式重现?

提前感谢您的帮助。

我也在 Liferay 论坛上发布了同样的问题:Problem to display JournalArticle inserted by SOAP web service

【问题讨论】:

    标签: web-services soap liferay


    【解决方案1】:

    您可以尝试记录从 Liferay 访问的数据库,并查看手动保存文章后会更改的内容。此处将hibernate的日志级别设置为info或debug。

    【讨论】:

    • 我在哪里可以记录使用休眠级别从 Liferay 访问的数据库?谢谢
    • 好的,我通过在portal-ext.properties hibernate.show_sql=true log4j.logger.org.hibernate=info 中添加以下内容找到了记录数据库的方式。 addArticle(...) 方法和 Publish 操作似乎使用相同的 SQL 操作(插入和更新)。我正在尝试理解一百行代码,如果找到解决方案,我将分享。
    【解决方案2】:

    你是这样设置 serviceContext 的吗?

    ServiceContext serviceContext = new ServiceContext();
    serviceContext.setAddGuestPermissions(true);
    serviceContext.setAddGroupPermissions(true);
    serviceContext.setScopeGroupId(groupId);
    serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);
    

    【讨论】:

    • 是的,Mario,我的设置是这样的,但它仍然无法正常工作。有关信息,在 journalArticleServiceSoap.addArticle 方法中,我已将 structureId 替换为 null,因为似乎在 6.1.1 版本的 liferay 中,设置此值会导致 java.rmi.RemoteException。
    • 当然在数据库中我用正确的值替换了structureId。此外,当我比较(在数据库中)插入的行和另一行时,我看不出有任何区别。
    • 我正在寻找我编写的一些代码,并发现我使用 WorkflowConstants.STATUS_APPROVED 而不是 WorkflowConstants.ACTION_PUBLISH
    • 现在以“已批准”状态插入内容。但它仍然没有直接显示,我必须通过 LR“发布”按钮再次发布它。
    【解决方案3】:

    你必须像这样设置 serviceContext:

       ServiceContext serviceContext = new ServiceContext();
        //serviceContext.setAddGuestPermissions(true);
        //serviceContext.setAddGroupPermissions(true);
        serviceContext.setScopeGroupId(groupId);
        serviceContext.setWorkflowAction(1);
        serviceContext.setIndexingEnabled(true);
    

    serviceContext.setIndexingEnabled(true);非常重要。

    以下代码不是必须的。

    serviceContext.setAddGuestPermissions(true);
    
    serviceContext.setAddGroupPermissions(true);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-16
      • 2011-09-15
      • 2018-02-05
      • 2015-02-11
      • 2011-08-22
      • 2011-04-01
      相关资源
      最近更新 更多