instructure / ims-lti

A Ruby library to help implement IMS LTI tool consumers and providers
MIT License
199 stars 122 forks source link

REXML Exception when using post_replace_result method #12

Closed jasonblanchard closed 11 years ago

jasonblanchard commented 11 years ago

When I try to POST a grade from an LTI provider similarly to the Sinatra example app like this:

res = @tp.post_replace_result!(params['score'])

I'm getting a #<REXML::ParseException: Missing end tag for 'link' (got "head") exception. Full stack trace below.

Any suggestions on how to track this one down? Is this in this Gem or something on my end? I've gotten this to work before, but I'm a little lost with this one.

Thanks!


<REXML::ParseException: Missing end tag for 'link' (got "head")

Line: 236 Position: 18074 Last 80 unconsumed characters:

/home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rexml/parsers/baseparser.rb:338:in pull_event' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rexml/parsers/baseparser.rb:183:inpull' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rexml/parsers/treeparser.rb:22:in parse' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rexml/document.rb:281:inbuild' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rexml/document.rb:43:in initialize' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/bundler/gems/ims-lti-544874ea0690/lib/ims/lti/outcome_response.rb:108:innew' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/bundler/gems/ims-lti-544874ea0690/lib/ims/lti/outcome_response.rb:108:in process_xml' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/bundler/gems/ims-lti-544874ea0690/lib/ims/lti/outcome_response.rb:78:inprocess_post_response' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/bundler/gems/ims-lti-544874ea0690/lib/ims/lti/outcome_request.rb:134:in post_outcome_request' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/bundler/gems/ims-lti-544874ea0690/lib/ims/lti/outcome_request.rb:81:inpost_replace_result!' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/bundler/gems/ims-lti-544874ea0690/lib/ims/lti/tool_provider.rb:130:in post_replace_result!' /vagrant/projects/apprennet-com/app/models/lti_session.rb:65:insend_grade_postback' /vagrant/projects/apprennet-com/app/controllers/lti_launcher_controller.rb:35:in test_grade_postback' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:insend_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in process_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:inprocess_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in block in process_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:414:in_run677254598process_action38662926callbacks' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in __run_callback' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in_run_process_action_callbacks' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in run_callbacks' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:inprocess_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in process_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:inblock in process_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in block in instrument' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:ininstrument' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in instrument' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:inprocess_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in process_action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:inprocess' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in process' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:indispatch' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in dispatch' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:inblock in action' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:indispatch' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/journey-1.0.4/lib/journey/router.rb:68:inblock in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/journey-1.0.4/lib/journey/router.rb:56:in each' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/journey-1.0.4/lib/journey/router.rb:56:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/mongoid-2.7.1/lib/rack/mongoid/middleware/identity_map.rb:33:inblock in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/mongoid-2.7.1/lib/mongoid.rb:133:in unit_of_work' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/mongoid-2.7.1/lib/rack/mongoid/middleware/identity_map.rb:33:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/warden-1.2.3/lib/warden/manager.rb:35:in block in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/warden-1.2.3/lib/warden/manager.rb:34:incatch' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/warden-1.2.3/lib/warden/manager.rb:34:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/etag.rb:23:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/conditionalget.rb:25:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:210:incontext' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/session/abstract/id.rb:205:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/dragonfly-0.9.15/lib/dragonfly/cookie_monster.rb:9:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:inblock in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in _run__366245983__call__1040513793__callbacks' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in__run_callback' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in _run_call_callbacks' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:inrun_callbacks' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:65:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:incall_app' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in block in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:intagged' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/runtime.rb:17:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/lock.rb:15:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/dragonfly-0.9.15/lib/dragonfly/middleware.rb:13:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:inforward' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in fetch' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:inlookup' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in call!' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/engine.rb:479:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/application.rb:223:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/content_length.rb:14:in call' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/railties-3.2.13/lib/rails/rack/log_tailer.rb:17:incall' /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in service' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:138:inservice' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in run' /home/vagrant/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/webrick/server.rb:295:inblock in start_thread' ... Missing end tag for 'link' (got "head") Line: 236 Position: 18074 Last 80 unconsumed characters:

Line: 236 Position: 18074 Last 80 unconsumed characters:

jasonblanchard commented 11 years ago

On further investigation, this looks like it might be an error page that Blackboard is sending back after an attempted grade POST request. I think OutcomeResponse#process_post_response is trying to parse that error page instead of the actual XML.

I'm having trouble launching in Canvas from localhost, but once I get that going I'll test there.

jasonblanchard commented 11 years ago

Just confirmed that the grade POST worked as-is in Moodle, so I think this is just a problem with the HTTP response from Blackboard. I'm going to close this for now.