[Building Sakai] Using web service to import test

Karen Tsao ktsao at stanford.edu
Thu Aug 5 11:22:48 PDT 2010


Hi Yuanhua,

Please take a look at XmlUtil.readDocument. It gets you the Document object.
Once you have the document, skip those SamiLite process and pass it directly
into qtiService.createImportedAssessment (the new API that Earlie created) .
That is, commented out following lines:

SamLiteService samLiteService = (SamLiteService)
ComponentManager.get("org_sakaiproject_tool_assessment_services_samlite_SamLiteService");

...
QuestionGroup questionGroup =
samLiteService.parse(FormattedText.escapeHtml(title, false),
FormattedText.escapeHtml(description, false), FormattedText.escapeHtml(data,
false));
...

Please give this a try and let me know if this works for you.

Thanks,
Karen


On Wed, Aug 4, 2010 at 6:43 PM, Qu, Yuanhua <yq12 at txstate.edu> wrote:

>  I think I might find the reason why it failed me in the first place. --
>  It is “The format of the assessment file that is going to import”.
>
> I tried with another file called importTest.txt as per attachment  (I guess
> this is the Word2QTI format) as per
> http://confluence.sakaiproject.org/display/QTI/Home  and used the same
> perl script to call the web service and the test was imported with the
> questions in the importTest.txt.  It has the test and all the questions in
> the site now.
>
> Well, Is there a web service created for importing the exported assessment
> like exportAssessment.xml directly?  Any quick pointer to let me know which
> method to call if I need to write my own web service for this purpose?
>
> Thanks.
>
> -Qu
>
>
>
> On 8/4/10 8:13 PM, "Qu, Yuanhua" <yq12 at txstate.edu> wrote:
>
> I was looking at http://jira.sakaiproject.org/browse/SAM-942 and saw that
> Earle was able to import assessment by using the services included in the
> patch.  I didn’t have the luck and would like to see if you know what might
> be wrong in my case.
>
> I’m using sakai2.6.2 and applied both patches for SamLite APIs and web
> services.  I’m using Perl script to call the service to import the
> assessment in file exportAssessment.xml
>
>
>
> open FILE, "data/exportAssessment.xml" or die $!;
> my $siteid = '5f852a89-eb01-4b0e-8f2f-f581eea945fc';
> while (<FILE>) {
>         $data .= $_;
> }
> close FILE;
>
> my $result = $scriptsoap->createAssessment($session, $siteid, "", "WS test
> creation 3", "first test created by WS", "Default Assessment Type",
> $data)->result;
>
>
>
>
> I did see test named “WS test creation 3” created in the site, but the
> question was not imported into the test.
>
> I have no problem importing the assessment by using “Import” button in the
> site.  Any help would be appreciated?
>
> Thanks.
>
> -Qu
>
>
>
> _______________________________________________
> 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/20100805/05e373c1/attachment.html 


More information about the sakai-dev mailing list