[system] / branches / rel-2-4-patches / webwork2 / lib / RQP.pm Repository:
ViewVC logotype

View of /branches/rel-2-4-patches/webwork2/lib/RQP.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3253 - (download) (as text) (annotate)
Thu Jun 2 16:32:52 2005 UTC (7 years, 11 months ago) by gage
Original Path: trunk/webwork2/lib/RQP.pm
File size: 3834 byte(s)
These two files provide a connection via SOAP with Moodle.  You will
need to modify the webwork.apache-config file as well.

    1 #!/usr/local/bin/perl   -w
    2 
    3 
    4 use SOAP::Lite +trace;
    5 #+trace =>
    6 #[parameters,trace=>sub{ local($|=1); print LOG "start>>",
    7 #WebworkWebservice::pretty_print_rh(\@_ ),"<<stop\n\n"; }];
    8 
    9 
   10 
   11 use WebworkWebservice;
   12 package RQP;
   13 @ISA =   (SOAP::Server::Parameters);
   14 local(*MYLOG);
   15 
   16 #print MYLOG "restarting server\n\n";
   17 sub test {
   18   open MYLOG, ">>/home/gage/debug_info.txt" ;
   19   local($|=1);
   20   my $som = pop;
   21   my $self = shift;
   22   my $rh_parameter = $som->method;
   23   #$som->match('/');
   24   #print MYLOG "headers\n", WebworkWebservice::pretty_print_rh($rh_parameter),"\n";
   25   #warn "parameters ", WebworkWebservice::pretty_print_rh($rh_parameter);
   26   #my $params = $som->paramsall();
   27   #warn "params ", join(" ", @{$params});
   28   print MYLOG "body ", WebworkWebservice::pretty_print_rh($som->body);
   29   close(MYLOG);
   30   return "test hi bye";
   31 }
   32 
   33 sub RQP_ServerInformation {
   34   my $class = shift;
   35   my $soap_som = pop;
   36   my $rh_params= $soap_som->method;
   37   local(*DEBUGLOG);
   38     open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file";
   39   print DEBUGLOG "--RQP_ServerInformation\n";
   40 
   41   $rh_out = { 'identifier'       => 'http://www.openwebwork.org',
   42                  'name'            => 'WeBWorK',
   43                  'description'     => 'WeBWorK server.  See http://webwork.math.rochester.edu',
   44                  'cloning'         => 0,
   45                  'implicitCloning' => 1,
   46                  'rendering'       => 1,
   47                  'itemFormats'     => ['pg'],
   48                  'renderFormats'   => ['xml'],
   49                  input            => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>',
   50   };
   51   return $rh_out;
   52 }
   53 
   54 sub RQP_ItemInformation {
   55   my $class = shift;
   56   my $soap_som = pop;
   57   my $rh_params= $soap_som->method;
   58   local(*DEBUGLOG);
   59     open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file";
   60     print DEBUGLOG "--RQP_ItemInformation\n";
   61   my $format = 'HTML';
   62   my $sourceErrors = '';
   63   $rh_out = {
   64       'format'            => $format,
   65        'sourceErrors'       => $sourceErrors,
   66        'template'           => 1,
   67        'adaptive'           => 1,
   68        'timeDependent'      => 0,
   69        'canComputeScore'   => 1,
   70        'solutionAvailable'  => 0,
   71        'hintAvailable'      => 0,
   72        'validationPossible' => 1,
   73        'maxScore'           => 1,
   74        'length'             => 1,
   75        input                => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>',
   76   };
   77   close(DEBUGLOG);
   78   return $rh_out;
   79 }
   80 
   81 sub RQP_ProcessTemplate {
   82 
   83 
   84 }
   85 
   86 sub RQP_Clone  {
   87 
   88 }
   89 sub RQP_SessionInformation {
   90   my $class = shift;
   91   my $soap_som = pop;
   92   my $rh_params= $soap_som->method;
   93   local(*DEBUGLOG);
   94     open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file";
   95   print DEBUGLOG "--RQP_SessionInformation\n";
   96   my $templateVars = [];
   97   my $correctResponses = [];
   98   $rh_out = {
   99     'templateVars'     => $templateVars,
  100     'correctResponses' => $correctResponses,
  101     input              => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>',
  102   };
  103   close(DEBUGLOG);
  104   return $rh_out;
  105 }
  106 
  107 
  108 sub RQP_Render  {
  109   my $class = shift;
  110   my $soap_som = pop;
  111   my $rh_params= $soap_som->method;
  112   local(*DEBUGLOG);
  113     open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file";
  114   print DEBUGLOG "--RQP_Render\n";
  115   #my $output = WebworkWebservice::pretty_print_rh(\%parameters);
  116   my $source = $rh_params->{source};
  117   $source =~s/</&lt;/g;
  118   $source =~s/>/&gt;/g;
  119   my $output = "the first element is ". $self. " and the last ". ref($envelope)."\n\n";
  120   $output .= WebworkWebservice::pretty_print_rh($rh_params);
  121   my $rh_out = {
  122     templateVars     => [],
  123     persistentData   => '',
  124     outcomeVars      => [],
  125     output           => $output,
  126     source           => $source,
  127     input            => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>',
  128 
  129   };
  130   close(DEBUGLOG);
  131   return $rh_out;
  132 
  133 }
  134 
  135 
  136 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9