[Building Sakai] Web service and Samigo
Earle Nietzel
Earle.Nietzel at marist.edu
Fri Jul 2 14:17:19 PDT 2010
Hi,
I am trying to expose the 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, its as though 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);
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20100702/cdf1ffc5/attachment.html
More information about the sakai-dev
mailing list