[Building Sakai] SakaiScripts.jws - why don't they return id's rather than just 'success'?

Matthew Jones matthew at longsight.com
Fri Jun 8 08:25:36 PDT 2012


I also agree, we also don't have these versioned so at this point you'd
have to keep this old method returning what it does and a new method
returning something new.

Php (and others) can deal with complextype but it increases the complexity
for sure.
 On Jun 8, 2012 11:13 AM, "Sam Ottenhoff" <ottenhoff at longsight.com> wrote:

> My concern: how does a language like PHP or Perl interpret a returned
> HashMap from a SOAP call?
>
> We should be able to interact with SOAP web services with all languages.
>  I think we should avoid things like method overloading in the JWS files
> (PHP and other languages cannot handle methods with the same name), and my
> instinct is that returning a HashMap is going to be difficult.  I would do
> a bit of refactoring instead and add a new method to get the page id
> returned.
>
> --Sam
>
> On Fri, Jun 8, 2012 at 11:07 AM, Patrick Haggood <phaggood at umich.edu>wrote:
>
>> Working on a jira (https://jira.sakaiproject.org/browse/UMICH-485)  to
>> automatically insert a tool onto user sites, I found that the methods for
>> creating pages and properties only return 'success'.  When adding a page,
>> it'd be good to receive the newly generated unique id rather than the name
>> of the created element which *might* not be unique.  In the jira SAK-22206
>> I propose extending a few of the methods in SakaiScripts.jws into
>> SakaiWS.jws thus:
>>
>>  public HashMap addNewPageToSite( String sessionid, String siteid,
>> String pagetitle, int pagelayout) throws AxisFault
>>
>> {
>>
>>   successMessage = new HashMap<String,String>();
>>
>> Session session = establishSession(sessionid);
>>
>>  try {
>>
>>  Site siteEdit = null;
>>
>>  SitePage sitePageEdit = null;
>>
>>  siteEdit = siteService.getSite(siteid);
>>
>>  sitePageEdit = siteEdit.addPage();
>>
>>  sitePageEdit.setTitle(pagetitle);
>>
>>  sitePageEdit.setLayout(pagelayout);
>>
>>  siteService.save(siteEdit);
>>
>>  successMessage.put("pageid",sitePageEdit.getId());
>>
>>  successMessage.put("siteid",siteEdit.getId());
>>
>>  successMessage.put("result","success");
>>
>> }
>>
>> catch (Exception e) {
>>
>>  LOG.error("WS addNewPageToSite(): " + e.getClass().getName() + " : " +
>> e.getMessage());
>>
>>  throw new AxisFault("WS addNewPageToSite(): Unable to sadd page " +
>> pagetitle + " to site id " +siteid);
>>
>> }
>>
>> LOG.info("generated pageid " + successMessage.get("pageid"));
>>
>> return successMessage;
>>
>> }
>>
>>
>> In this manner, if I check the map key 'result' 's value for 'success', I
>> can use the key 'pageid' to get the unique pageid for use in subsequent WS
>> calls like
>>
>> addConfigPropertyToPage( String sessionid, String siteid, String pageid,
>> String propname, String propvalue)
>>
>> rather than the existing script in SakaiScript which uses pagetitle
>>
>> addConfigPropertyToPage( String sessionid, String siteid, String
>> pagetitle, String propname, String propvalue)
>>
>>
>> Any concerns or suggestions on this approach?
>>
>>
>>
>> _______________________________________________
>> sakai-dev mailing list
>> sakai-dev at collab.sakaiproject.org
>> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>>
>> TO UNSUBSCRIBE: send email to
>> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
>> "unsubscribe"
>>
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20120608/4eb5b80c/attachment.html 


More information about the sakai-dev mailing list