2013-03-28 85 views
0

我使用與Tomcat服務器和Oracle 10g數據庫捆綁在一起的Liferay 6.1.1-ce-ga2。 我的目標是插入一些內容,如期刊文章,並將它們顯示在資產出版商(結構和模板已在使用)中。Liferay web服務

我使用JournalArticleServiceSoap.addArticle(...)與正確的字段(groupid, structureid, templateid, ...)。內容被「正確」插入到數據庫中,我可以從管理員內容面板的網頁內容中看到它們。內容也有"Approved"作爲狀態。這是通過設置:

serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH) 

不過,我不能看到在資源發佈的其他內容的顯示的內容插入,直到我再次打開它進行編輯和點擊發布按鈕(即使不改變什麼)。然後,內容按預期發佈。問題是內容的數量。這是大約600,所以我不能爲每一個這個行動。

我不明白怎麼回事,怎麼弄出來的?換句話說,我需要做些什麼才能使Web服務插入的Web內容自動顯示在Asset Publisher中?

或者,"Publish"做什麼,我可以嘗試用SOAP服務(或插入後的SQL)以編程方式重現?

非常感謝您的幫助。

我也張貼在Liferay的論壇同樣的問題:Problem to display JournalArticle inserted by SOAP web service

回答

0

,你可以嘗試登錄該數據庫從Liferay的訪問,看看你保存文章manualy後會有什麼改變。這裏設置hibernate的日誌級別爲info或debug。

+0

我在哪裏可以登錄使用休眠級別從Liferay訪問的數據庫? Thx – jacques

+0

好的,我找到了登錄數據庫的方式,在portal-ext.properties'hibernate.show_sql = true log4j.logger.org.hibernate = info'中加入以下內容。 addArticle(...)方法和Publish操作似乎使用相同的SQL操作(插入和更新)。我想了解百行代碼,如果找到解決方案,我會分享。 – jacques

0

你是否像這樣設置serviceContext?

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

是的Mariol,我的設置就是這樣,但它仍然不起作用。有關信息,在'journalArticleServiceSoap.addArticle'方法中,我用空替換了structureId,因爲在6.1.1版本的liferay中似乎設置此值會導致java.rmi.RemoteException。 – jacques

+0

當然,在數據庫中,我用正確的值替換了structureId。另外當我比較(在數據庫中)插入的行和另一個,我看不出任何區別。 – jacques

+0

我正在尋找一些我編寫和創建的代碼,我使用了WorkflowConstants.STATUS_APPROVED而不是WorkflowConstants.ACTION_PUBLISH – Mariol

0

您必須設置serviceContext這樣的:

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

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

以下代碼不是必須重複的。

serviceContext.setAddGuestPermissions(true); 

serviceContext.setAddGroupPermissions(true);