Foren
Adding Article via Web Service with Published Status
Chris Buley, geändert vor 13 Jahren.
Adding Article via Web Service with Published Status
New Member Beiträge: 4 Beitrittsdatum: 21.10.10 Neueste Beiträge
Using Liferay 6 with Tomcat Bundle.
I am successfully adding journal articles to my liferay system and then adding categories to the associated Asset. All of that is going well, and I am about 90% to where I need to be. One last stumbling block is how I can make the posted articles have a published status after I have added them rather than draft status. Any help would be greatly appreciated.
Here is the basic code snippet I am using:
I am successfully adding journal articles to my liferay system and then adding categories to the associated Asset. All of that is going well, and I am about 90% to where I need to be. One last stumbling block is how I can make the posted articles have a published status after I have added them rather than draft status. Any help would be greatly appreciated.
Here is the basic code snippet I am using:
ServiceContext context = new ServiceContext();
JournalArticleSoap newArticle = jasssSoap.addArticle(
groupId,
"", // articleId, or blank string if using auto
true, // autoArticleId?
title,
abstractText,
body,
"news", // type
"", // structureId
"", // templateId
cal.get(Calendar.MONTH), //displayDateMonthInt
cal.get(Calendar.DAY_OF_MONTH), //displayDateDayInt
cal.get(Calendar.YEAR), //displayDateYearInt
cal.get(Calendar.HOUR_OF_DAY), //displayDateHourInt
cal.get(Calendar.MINUTE), //displayDateMinuteInt
1, //expirationDateMonthInt
1, //expirationDateDayInt
1, //expirationDateYearInt
1, //expirationDateHourInt
1, //expirationDateMinuteInt
true, //neverExpireBool
1, //reviewDateMonthInt
1, //reviewDateDayInt
1, //reviewDateYearInt
1, //reviewDateHourInt
1, //reviewDateMinuteInt
true, //neverReview
true, //indexable
null, //articleUrl
context //serviceContextProbablyNull
);
AssetEntryServiceSoap aesssSoap = aesssLocator.getPortlet_Asset_AssetEntryService(generateUrl(userId, password,"Portlet_Asset_AssetEntryService"));
long[] categoryIds = new long[] {catId};
String[] tagNames = new String[0];
// This call is modeled on a call in AssetEntryLocalServiceImpl for just updating the cats
aesssSoap.updateEntry(
newArticle.getGroupId(),
"com.liferay.portlet.journal.model.JournalArticle",
newArticle.getResourcePrimKey(),
null, // classUuid
categoryIds,
tagNames,
true, // visible
null, // start date
null, // endDate
null, // publishDate
null, // expirationDate
null, // mimeType
null, // title
null, // description
null, // summary
null, // url
0, // height
0, // width
0, // priority
false //sync
);
Fabien Fabien, geändert vor 12 Jahren.
RE: Adding Article via Web Service with Published Status
New Member Beiträge: 5 Beitrittsdatum: 17.05.11 Neueste Beiträge
Hi.
I am actually having the same problem. Do you find an issue to published an article by webservice ?
Sincerely
I am actually having the same problem. Do you find an issue to published an article by webservice ?
Sincerely
Hitoshi Ozawa, geändert vor 12 Jahren.
RE: Adding Article via Web Service with Published Status
Liferay Legend Beiträge: 7942 Beitrittsdatum: 24.03.10 Neueste Beiträge
The easiest way if you're not using workflow, is to just disable a workflow from the control panel.
Control Panel -> Workflor Configuration -> set Web Content to "Default: No workflow" and save the change.
Control Panel -> Workflor Configuration -> set Web Content to "Default: No workflow" and save the change.
Kousik Kumar Das, geändert vor 11 Jahren.
RE: Adding Article via Web Service with Published Status
New Member Beiträge: 7 Beitrittsdatum: 09.05.11 Neueste Beiträge
I'm working with LF 6.1.10 server, and have no workflow (kaleo) enabled.
While trying to publish the newly created article through webservice (soap api) implementation, its creating article with DRAFT status.
Code snippet, I tried:
Any help
While trying to publish the newly created article through webservice (soap api) implementation, its creating article with DRAFT status.
Code snippet, I tried:
articleSoap = journalArticleServiceSoap.addArticle(groupId, classNameId, classPK, articleId, autoArticleId, titleMapLanguageIds, titleMapValues, descriptionMapLanguageIds, descriptionMapValues, webContent, type, structureId, templateId, layoutUuid, displayDateMonth, displayDateDay, displayDateYear, displayDateHour, displayDateMinute, expirationDateMonth, expirationDateDay, expirationDateYear, expirationDateHour, expirationDateMinute, neverExpire, reviewDateMonth, reviewDateDay, reviewDateYear, reviewDateHour, reviewDateMinute, neverReview, indexable, articleURL, serviceContext);
articleSoap.setStatus(WorkflowConstants.STATUS_APPROVED);
articleSoap.setStatusByUserId(userId);
articleSoap.setStatusByUserName(username);
articleSoap.setStatusDate(GregorianCalendar.getInstance());
serviceContext.setUserId(userId);
serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);
updateArticle(groupId, articleSoap.getArticleId(), new Double("1.0").doubleValue(), webContent, serviceContext);
Any help
Kousik Kumar Das, geändert vor 11 Jahren.
RE: Adding Article via Web Service with Published Status
New Member Beiträge: 7 Beitrittsdatum: 09.05.11 Neueste Beiträge
Here I made it to work !!!
All we need to prepare the ServiceContext properly before the call journalArticleServiceSoap.addArticle(...) method.
code:
The above bold line will create your journal article with APPROVED status.
Happy learning !!! folks !!!
All we need to prepare the ServiceContext properly before the call journalArticleServiceSoap.addArticle(...) method.
code:
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGuestPermissions(true);
serviceContext.setAddGroupPermissions(true);
serviceContext.setScopeGroupId(groupId);
serviceContext.setWorkflowAction(WorkflowConstants.ACTION_PUBLISH);
The above bold line will create your journal article with APPROVED status.
Happy learning !!! folks !!!