[Building Sakai] Web service and Samigo (repost)

Stephen Marquard stephen.marquard at uct.ac.za
Mon Jul 12 09:31:55 PDT 2010


Hi Earle,

I don't know if there's a way around it in the current code, but generally speaking I'd consider referencing tool placement (and therefore site context) in service code to be a design flaw. I'd suggest filing a JIRA about it.

Regards
Stephen 
 
>>> Earle Nietzel <Earle.Nietzel at marist.edu> 7/12/2010 5:47 PM >>> 
Just sending this again since I sent it on the holiday weekend!

Hi, 

I am trying to expose samlite via a web service but have run into an 
issue. I have combed over the code for half a day now and have not come up 
with a good solution so i need pick someone's brain. 

I have not located an api that allows you to import an assessment directly 
to a specific site in samigo, your location in sakai is managed via the 
servlets (tool placement id, url) and i can't duplicate that in a web 
service. 

Does anyone have any insight? 

Thanks for any help, 
Earle 

To help I am including the web service method as psuedo code: 
  

       public boolean createAssessment(String sessionid, String siteid, 
String siteproperty, String name, String description, String data) throws 
AxisFault { 

                Session session = establishSession(sessionid); 

                Site site = null; 

                if (siteproperty != null && siteproperty.length() > 0) { 
                        // find sakai site id using enterprise 
siteproperty=siteid 
                        site = findSite(siteproperty, siteid); 
                } else { 
                        try { 
                                // use siteid as the sakai site id 
                                site = SiteService.getSite(siteid); 
                        } catch (IdUnusedException ieu) { 
                                site = null; 
                        } 
                } 

                if (site != null) { 
                        //siteToolReference(site.getId(), "sakai.samigo"); 


                        SamLiteService samLiteService = (SamLiteService) 
ComponentManager.get(SamLiteService.class); 

                        QuestionGroup questionGroup = 
samLiteService.parse(name, description, data); 
                        Document document = 
samLiteService.createDocument(questionGroup); 

                        QTIService qtiService = new QTIService(); 
                        AssessmentFacade asessment = 
qtiService.createImportedAssessment(document, QTIVersion.VERSION_1_2, 
null, AssessmentTemplateFacade.DEFAULTTEMPLATE.toString()); 

 
//EventTrackingService.post(EventTrackingService.newEvent("sam.assessment.create", 
"assessmentId=" + assessment.getAssessmentId(), true)); 
                        return true; 
                } else { 
                        LOG.warn("WS SiteArchive.createAssessment(): Site 
not found - " + siteid); 
                        throw new AxisFault("WS 
SiteArchive.createAssessment(): Site not found - "+ siteid); 
                } 
        }



 

###
UNIVERSITY OF CAPE TOWN 

This e-mail is subject to the UCT ICT policies and e-mail disclaimer published on our website at http://www.uct.ac.za/about/policies/emaildisclaimer/ or obtainable from +27 21 650 4500. This e-mail is intended only for the person(s) to whom it is addressed. If the e-mail has reached you in error, please notify the author. If you are not the intended recipient of the e-mail you may not use, disclose, copy, redirect or print the content. If this e-mail is not related to the business of UCT it is sent by the sender in the sender's individual capacity.

###
 


More information about the sakai-dev mailing list