So finally, huh!
LtiLibrary (my .NET library for LTI web applications) is now at version 1.6. The big change is the addition Outcomes 2.0 (Draft). Outcomes 2.0 has been in draft status since December 2014. I hope by including support in LtiLibrary, a few people will take up the charge to implement Outcomes 2.0 in production which will help move the spec into final status.
There are two packages on NuGet
You’ll want both if you want Outcomes 2.0. All the source code is on GitHub
Getting Started with Outcomes-2
There are two ApiControllers in LtiLibrary.AspNet that implement the LineItems and LISResult endpoints.
- LtiLibrary.AspNet.Outcomes.v2.LineItemsControllerBase
- LtiLibrary.AspNet.Outcomes.v2.ResultsControllerBase
You will need to create your own controllers in your application that inherit from these to handle the actual data. For example,
There are two sample applications in LtiSamples that implement Outcomes-2. SimpleLti is a single page app that hosts both the Tool Consumer and Tool Provider. ConsumerCertification is a simple Tool Consumer that makes all the necessary launch requests to a Tool Provider (yours or someone else’s) to exercise the certification tests.
The biggest advantage I see in Outcomes-2 over Outcomes-1 is that Outcomes-2 supports a comment and a status with each result. In K12, publishers are starting to deliver content catalogs via Thin Common Cartridge where each LTI link points to a single activity such as a lesson or quiz. Let’s say those activities require manual grading. With Outcomes-2, the activity can send a “Completed” result (perhaps with a comment like “Submitted”) to tell the teacher the activity is ready for grading. When the teacher grades the submission, the activity could send a “Final” result (with “Good job!”).
Have fun!
Hello Andy,
How can I use Post score function to post for all students in the class? For now I can post and update my own score.
Thank you!
The IMS LTI Outcomes 1.0 spec does not support posting multiple outcomes at once. You will have to post them one at a time. The Tool Consumer will probably do some authorization checking to make sure you are allowed to post outcomes for multiple students. Please check with the Tool Consumer for details.
How do I post result with version 2 from Web Forms?
I understand using version 1
LtiLibrary.Core.Outcomes.v1.OutcomesClient.PostScore(Request.Form[“lis_outcome_service_url”].ToString(), Request.Form[“oauth_consumer_key”].ToString(), clsLtiParams.SharedSecret, Request.Form[“lis_result_sourcedid”].ToString(), 0.40);
but in version 2 how do i construct the LtiLibrary.Core.Outcomes.v2.LisResult result = new LtiLibrary.Core.Outcomes.v2.LisResult();
Essentially how do i convert lis_result_sourcedid into the lisResult
Take a look at https://github.com/andyfmiller/LtiSamples/blob/master/SimpleLti/Controllers/ProviderController.cs#L203. Please note that LtiLibrary support for Outcomes 2.0 is based on the draft spec. The spec is undergoing quite a bit of review and revision. It is likely going to be much different when it is finalized.
Hi Andy,
I’m struggling with the response to a outcome. Our provider (Moodle) claims that they received the following response (after succesfully replace the score):
2017-11-30 09:53:14 [RESPONSE]:
{“imsx_POXHeaderField”:
{“itemField”:
{“imsx_versionField”:0,
“imsx_messageIdentifierField”:”420a4b12-2644-4a8c-b98c-8ca72ca00611″,
“imsx_sendingAgentIdentifierField”:null,
“imsx_statusInfoField”:
{“imsx_codeMajorField”:0,
“imsx_severityField”:0,
“imsx_descriptionField”:”Score for 6895fa5c-b636-477b-a2bf-90a51df5ee14 is now 0.744445″,
“imsx_messageRefIdentifierField”:”1512031992″,
“imsx_operationRefIdentifierField”:null,
“imsx_codeMinorField”:null
}
}
},
“imsx_POXBodyField”:
{“itemField”:{}
}
}
And they expect something like this:
HTTP/1.1 200 OK
Date: Tue, 05 Dec 2017 14:40:24 GMT
Server: Apache/2.4.29 (cPanel) OpenSSL/1.0.2m mod_bwlimited/1.4
X-Powered-By: PHP/5.6.32
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/xml; charset=utf-8
basic-lis-updateresult
Success
Status
Score for 71fba0d51d3568dd79e76874605b9010:::S3294476:::29123:::dyJ86SiwwA9 is now 1
I cannot figure out what i’m doing wrong. I use vs2015, and have included your
LtiLibrary 1.4.5
LtiLibrary.AspNet 1.6.2
LtiLibrary.Core 1.6.2
Can you point me in a direction to solve this? Thanks in advanced,
Regards,
Peter
Hmm… I see that the XML is removed in the expected response…
That’s alright, I guessed it was XML.
It looks like the OutcomesController (OutcomesControllerBase) is returning json instead of XML. You should not need all 3 libraries, either LtiLibrary 1.4.5 or both LtiLibrary.AspNet and LtiLibrary.Core. I don’t know if that is the cause of the problem, but the first thing I would try is to remove the version of LtiLibrary you will not use and then try again.