New Math questions in Moodle Quizzes using WeBWorK

New Math questions in Moodle Quizzes using WeBWorK

by Michael Gage -
Number of replies: 5
Hi,

I’m happy to announce a version of WeBWorK that can serve mathematics questions via a Moodle quiz. This gives a tighter connection between Moodle and WeBWorK, allowing students to work exclusively with the Moodle quiz interface while WeBWorK produces the mathematics questions and processes the student answers in the background. The result is similar to using STACK to produce and process mathematics questions.

This is a first attempt at realizing the question level WeBWorK-Moodle bridge which I proposed in this forum in my earlier post last January ( https://moodle.org/mod/forum/discuss.php?d=277922) and on my blog (http://michaelgage.blogspot.com/2015/01/connecting-webwork-to-moodle-2xs.html )

It makes most of the 25K+ mathematics questions written for WeBWorK’s OpenProblemLibrary (http://webwork.maa.org/wiki/Open_Problem_Library) available for use in Moodle quizzes as well. The OPL began with questions designed for single and multivariable calculus courses (and that is still the majority of the collection) but has expanded in both up and down to include questions for linear algebra and differential equations, complex variables, operations research, and statistics; as well as precalculus and developmental mathematics problems and many other math subjects.

To see this Moodle/WeBWorK connection in action, view the Moodle course for linear algebra and differential equations at (https://devel3.webwork.rochester.edu/moodle/course/view.php?id=21). You will need to login as “visitor”, using the password “visitor” in order to view the quizzes. (Guests are not allowed to view Moodle quizzes.)

This is a mockup of the matrix algebra/ODE course which I taught in 2009 using the Moodle/WeBWorK assignment connection (which presents an entire homework assignment using the WeBWorK interface). In each week you’ll see the original WeBWorK assignment that I used (the icon is a yellow spider web on blue background) and near it the Moodle Quiz version of the same assignment. Try each of them to get a comparison between the WeBWorK/Moodle assignment bridge and the new WeBWorK/Moodle question bridge.

I have set the behavior of the Moodle Quiz so that it closely approximates the original WeBWorK assignment. These assignments are meant primarily for homework/practice not for normative assessment. The student can retry each question as often as she wishes and if there are several answer blanks then evaluation is given separately for each blank.

The Moodle portion of this bridge is built on the Opaque question type module implemented by Tim Hunt for interfacing with webservice test engines. I am indebted to Tim for help and advice while I was implementing this Moodle/WeBWorK question interface.

Information for installing and configuring the Moodle Opaque question type is available on github at https://github.com/moodleou. Specifically you need the opaque qtype module: https://github.com/moodleou/moodle-qtype_opaque and the opaque behaviour module: https://github.com/moodleou/moodle-qbehaviour_opaque.

I’ll provide more detailed suggestions for creating your own Moodle/WeBWorK questions later but for those somewhat familiar with both WeBWorK and Moodle here is the short explanation.
1. You create a new Opaque engine pointing to the url: https://devel3.webwork.rochester.edu/opaqueserver_wsdl and set the question bank URL for the engine to https://devel3.webwork.rochester.edu/webwork2/spring09mth165 .
2. For each question the questionID should be the same as the path of a WeBWorK problem in the OpenProblemLibrary with the following replacements.
The initial segment should be “library” instead of “Library”, each slash is replaced by two underscores, and each hyphen is replaced by three underscores. (This is required in order to conform to the Opaque client naming scheme.)
For example:
Library/Rochester/setAlgebra01RealNumbers/lhp1_31-34_mo.pg
is obtained using the questionID:
library__Rochester__setAlgebra01RealNumbers__lhp1_31___34_mo.pg

For those who are really impatient the WeBWorK server function is provided by adding the project opaque_server along side a standard WeBWorK course. The Opaque Server can be found at (https://github.com/mgage/opaque_server) along with minimal documentation for installing. That repo will be moved to the standard WeBWorK github site (https://github.com/openwebwork) after further testing (and after the documentation has been expanded).

This is the first version of the Moodle/WeBWorK question bridge so the behavior may change slightly in the future. Because STACK and WeBWorK are already very similar I would be interested in creating a question type that was interchangeable between the two background mathematics engines. Instructors would be able to mix STACK and WeBWorK questions in the same quiz in such a way that it was invisible (or nearly invisible) to students which engine was handling the question.

Your comments are welcome.

-- Mike Gage, University of Rochester, Rochester, NY
Average of ratings: Useful (4)
In reply to Michael Gage

Re: New Math questions in Moodle Quizzes using WeBWorK

by tim persson -

I'm attempting to install the opaque question bridge but am getting a SOAP error below when adding the engine in moodle 2.9.1....

Connection test failed.
<
>SoapFault exception: [soap:Client] SOAPAction shall match 'uri#method' if present (got 'none', expected 'https://www.rationalreasoning.net/OpaqueServer#getEngineInfo'
 in /home/rational/public_html/moodle/question/type/opaque/connection.php:107
Stack trace:
#0 /home/rational/public_html/moodle/question/type/opaque/connection.php(107): SoapClient->__call('getEngineInfo', Array)
#1 /home/rational/public_html/moodle/question/type/opaque/connection.php(107): qtype_opaque_soap_client_with_timeout->getEngineInfo()
#2 /home/rational/public_html/moodle/question/type/opaque/enginemanager.php(235): qtype_opaque_connection->get_engine_info()
#3 /home/rational/public_html/moodle/question/type/opaque/testengine.php(56): qtype_opaque_engine_manager->get_engine_info(Object(stdClass))
#4 {main}>
Connection test failed.

I believe the opaque server is running correctly in webwork and is returning a completed _wsdl page at https://rationalreasoning.net/opaqueserver_wsdl I am receiving an identical error when trying the rochester opaque server that is set up for the test course.  Does the pass key need to be set somewhere? I am also unable to get the test server to connect with a different error. 

Any help you can provide is appreciated. 

Tim

In reply to tim persson

Re: New Math questions in Moodle Quizzes using WeBWorK

by tim persson -

test server error...

Connection test failed.
<
>SoapFault exception: [Receiver] Could not resolve host: tjh238.vledev2.open.ac.uk in /home/rational/public_html/moodle/question/type/opaque/connection.php:184
Stack trace:
#0 [internal function]: qtype_opaque_soap_client_with_timeout->__doRequest('<?xml version="...', 'http://tjh238.v...', '', 1, 0)
#1 /home/rational/public_html/moodle/question/type/opaque/connection.php(107): SoapClient->__call('getEngineInfo', Array)
#2 /home/rational/public_html/moodle/question/type/opaque/connection.php(107): qtype_opaque_soap_client_with_timeout->getEngineInfo()
#3 /home/rational/public_html/moodle/question/type/opaque/enginemanager.php(235): qtype_opaque_connection->get_engine_info()
#4 /home/rational/public_html/moodle/question/type/opaque/testengine.php(56): qtype_opaque_engine_manager->get_engine_info(Object(stdClass))
#5 {main}>
Connection test failed.

In reply to tim persson

회신: Re: New Math questions in Moodle Quizzes using WeBWorK

by Jong-Dae Park -

Hello,

1) I recommend you to use webwork release 2.11

2) you need to update the webwork courses and open library

3) edit moodle folder/question/type/opaque/connection.php file - line 69

$this->soapclient = new $class($url.'?wsdl',array(....));; 

---> $this->soapclient = new $class($url,array(....));;  

4)  If you have a problem to restart the apache web server, you need to comment out the line 174 in connection.php

 if ($action) {

  $headers[] = 'SOAPAction: ' . $action;

     } else {

     //$headers[] = 'SOAPAction: none'; // Seemingly, this is necessary.

    }

good luck!
In reply to tim persson

Re: New Math questions in Moodle Quizzes using WeBWorK

by Michael Gage -
Sorry for the delay -- I thought I was subscribed to this discussion but apparently not.

That’s a minor bug (feature?) in the opaque question type. You need to make a change
around line 174 in question/type/opaque/connection.php.



The only change that I have made in the moodle-qtype_opaque repos code is in connection.php where I have commented out line 174.


To use the opaque client with WeBWorK you need to comment out the line 174
in connection.php
```
if ($action) {
$headers[] = 'SOAPAction: ' . $action;
} else {
//$headers[] = 'SOAPAction: none'; // Seemingly, this is necessary.
}
```

I don’t know why but commenting out this line is necessary to prevent the SOAP Lite implementation of SOAP from complaining.

See if that works.
In reply to tim persson

Re: New Math questions in Moodle Quizzes using WeBWorK

by Michael Gage -
To use the opaque client with WeBWorK you need to comment out the line 174
in connection.php
```
if ($action) {
$headers[] = 'SOAPAction: ' . $action;
} else {
//$headers[] = 'SOAPAction: none'; // Seemingly, this is necessary.
}

the error message is detecting a mismatch between the SOAPAction it was expecting and "none" which is what it was getting. Leaving out the header entirely appears to fix this problem.