LTI Grade sync with H5P failing

LTI Grade sync with H5P failing

Nick Stebbs -
回帖数:5

Greetings,

I am having an issue with the syncing of grades back to Moodle (LTI consumer of content on h5p.com).
The external tool is setup thus (although I was trying before with "Accept grade" set to always - same error.


screenshot external tool

And activity with privacy is setup thus:

scoring

activity settings

When a quiz is submitted, an xApi call is made to h5p.com, and the provider logs the account/results in the dashboard.

The incoming request to Moodle was failing with a 401 but we fixed an apache config setting with JWT headers.

Now the error is 

```2022-10-05 12:08:42    Error    13.54.204.179    400    POST /mod/lti/services.php/2/lineitems/25/lineitem/scores?type_id=2 HTTP/1.0        GuzzleHttp/7    528     Apache SSL/TLS access```

And with curl I get the response:

```{
    "status": 400,
    "reason": "No handler found for /2/lineitems/25/lineitem/scores  ",
    "request": {
        "method": "POST",
        "url": "/mod/lti/services.php/2/lineitems/25/lineitem/scores?type_id=2",
        "accept": "*/*"
    }
}```

Any advice would be appreciated as this is the last feature on a project due to be launched imminently,

Cheers

NIck

回复Nick Stebbs

Re: LTI Grade sync with H5P failing

Jake Dallimore -
Core developers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Testers的头像
Hi Nick,

What's the content-type header you're sending over with the score post? I ask this because we currently only support:
  • application/vnd.ims.lis.v1.scorecontainer+json
  • application/vnd.ims.lis.v1.score+json
At the time of writing this, this is in accordance with the existing AGS OpenAPI spec: https://www.imsglobal.org/spec/lti-ags/v2p0/openapi/#/default/LineItems.POST

Also, the content-type must be provided for a score post, so I'd definitely start by checking that's all in order.

Related to naming: I've just realised that 1Edtech (formerly IMS Global) have recently modified their existing published specification documents in a non-bc manner (e.g https://www.imsglobal.org/spec/lti-ags/v2p0#score-service-media-type-and-schema - login required), by changing this to 'application/vnd.1EdTech.lis.v1.score+json'. We validate the content-type is one of the two above schema names, so if the tool sends us this newer version, a different content type or nothing at all, we won't match a valid service handler, resulting in the kinds of errors you're seeing. We'd definitely need to patch Moodle if the plan is to accept that new schema name. I've raised this internally. Hopefully it was just a mistake on their part.

Cheers,
Jake
回复Jake Dallimore

Re: LTI Grade sync with H5P failing

Nick Stebbs -
Hi Jake,

I actually managed to get it working...
I created a new activity (different content type) using the same tool and settings but changed the scoring type to 'static' on the activity, meaning that it was always a fixed amount.
The grade type/maximum grade was then grayed out in Moodle and I started to see results being synced. I think it was some mismatch between the scoring systems.

I am still curious though so I will explore again with the same quiz I was using and post back here at a later date, noting the content types.

Cheers
Nick
回复Nick Stebbs

Re: LTI Grade sync with H5P failing

Jake Dallimore -
Core developers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Testers的头像
I'm assuming that 'static' is an H5P activity concept? The grade services spec basically only supports fractions going back from the tool to the platform, so perhaps whatever 'static' represents results in that (as opposed to whatever other format was used prior, when you experienced the error).

Will be interested to see what you come back with. Would be nice to know so others can benefit.

Thanks!
Jake
回复Nick Stebbs

Re: LTI Grade sync with H5P failing

Alexander Dominicus -
Testers的头像
Hi Nick,
maybe we have a similar problem with LTI 1.3 (our moodle is LTI consumer). I checked all settings concerning the gradebook twice but no grades are transferred to the gradebook.
So,
1.) What do you Apache configuration do you had to fix in view of JWT headers?
2.) When I edit the LTI-activity, and try to change the "scoring type" there's only "scale", "point" and "none" possible. So what is this type "static" you mentioned?
Cheers,
Alex
回复Alexander Dominicus

Re: LTI Grade sync with H5P failing

Nick Stebbs -
Hi Alexander,

The project was put on hold for some time, and my familiarity with all of this went out of the window! If I can reproduce the situation now I will get back to you with some answers, but can't be sure.

Cheers