Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Ana Mendoza Guasch
Problem with add-article with jsonws on 6.1 CE
June 22, 2012 5:08 AM
Answer

Ana Mendoza Guasch

Rank: New Member

Posts: 12

Join Date: March 23, 2012

Recent Posts

Hello,

I'm having trouble while trying to add articles with the jsonws api, whenever I put 0 as the value for classNameId, I get the following exception:

1{"exception":"com.liferay.portal.NoSuchGroupException: No Group exists with the primary key 0"}


I did use the right groupId. If I change classNameId to something else, for example, 1, the service works and the article gets added, but it doesn't appear on the web content list. STILL, it can be edited accessing it directly by URL, and everything works fine there. We changed all classNameId to 0 on database and they DO appear on the list now.

Is this a bug? Our first choice was SOAP, but we can't use it because of another bug: http://issues.liferay.com/browse/LPS-26177
Hitoshi Ozawa
RE: Problem with add-article with jsonws on 6.1 CE
June 23, 2012 11:03 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Is this a bug? Our first choice was SOAP, but we can't use it because of another bug: http://issues.liferay.com/browse/LPS-26177


That's not a bug. They just dropped the api. Liferay.com often does this. You'll just have to add it back in yourself. I found that this is the easiest way.
Edouard Perr
RE: Problem with add-article with jsonws on 6.1 CE
August 24, 2012 1:24 AM
Answer

Edouard Perr

Rank: Junior Member

Posts: 30

Join Date: August 20, 2012

Recent Posts

Hi!
It's a bit late, but it can be useful for future search.
On Liferay 6.1, to add a new article, you have to supply a ServiceContext. In this, you can set some fields like permissions, tags...
All the fields of the ServiceContext are optional except the GroupId ( called here scopeGroupId). It is the same as the groupId of your article.
I've got exactly the same exception, and this is what Liferay expect from me. ;)

Please refer to this wiki article :
ServiceContext Pattern
Harish Kumar
RE: Problem with add-article with jsonws on 6.1 CE
August 26, 2012 2:59 AM
Answer

Harish Kumar

Rank: Expert

Posts: 472

Join Date: July 31, 2010

Recent Posts

Hi

James posted a complete example of adding a journal article using jsonws here -

1http://www.liferay.com/community/forums/-/message_boards/message/13489024



Regards.
KARTHIK VENKATARAMAN
RE: Problem with add-article with jsonws on 6.1 CE
September 26, 2012 5:56 PM
Answer

KARTHIK VENKATARAMAN

Rank: New Member

Posts: 3

Join Date: September 26, 2012

Recent Posts

I have the same problem.
I am unable to add-article using the web service unless I set the classNameId to value other than 0.
But the article doesn't show up until I manually update the classNameId to 0 in the mySQL DB table JournalArticle
Please reply if you have solved this issue