celtic-project / LTI-PHP

PHP class library for building LTI integrations
GNU Lesser General Public License v3.0
48 stars 38 forks source link

Outcomes 1.1 Service is never successful #3

Closed wurfmaul closed 4 years ago

wurfmaul commented 4 years ago

I experienced some troubles using the outcomes service with this library.

Issue

The return value of ResourceLink.php::doOutcomesService() function is always false.

Environment

Outcomes url is provided by parameter lis_outcome_service_url.

Problem

The result of ResourceLink.php::doLTI11Service() is dropped after computing. In the following line the correct result is put to variable $ok, which is never processed thereafter: https://github.com/celtic-project/LTI-PHP/blob/46e89dc6e6dba110a3ae4754355bf9ceb48514df/src/ResourceLink.php#L630

Solution

One proposal would be to write the value to $response instead. Or to pass the value of $ok to the hook parameters.

spvickers commented 4 years ago

Are you sure the service is receiving a successful response from the tool consumer? As well as the lis_outcome_service_url parameter, you will also need to have received an lis_result_sourcedid for the user you are using the service for.

wurfmaul commented 4 years ago

Yes, the response is successful (specifically: <imsx_codeMajor>success</imsx_codeMajor>). My only problem is that the $response variable cannot be anything else than false here (except using a hook): https://github.com/celtic-project/LTI-PHP/blob/46e89dc6e6dba110a3ae4754355bf9ceb48514df/src/ResourceLink.php#L677

spvickers commented 4 years ago

It looks like I have fixed this issue but not committed the change yet. Does your code work if you change the "$ok = true;" line to be "$response = true;" as per your suggestion? This is what my current code has.

wurfmaul commented 4 years ago

Yes indeed: replacing this line seems to work fine!

spvickers commented 4 years ago

Excellent; I'll commit this and another change I have pending.