SOAP: Server Example


use SOAP::Transport::HTTP;
SOAP::Transport::https::CGI
    -> dispatch_to('TimeTable')  
# static dispatch to package
    -> handle;

package TimeTable;
sub getPaperTitle {
  use DBI;
  my ($packageName, $paperNumber) = @_;
  my $returnValue = "unkown";
  my $dbh = DBI->connect("DBI:mysql:timetable:localhost",
     "USER", "PASSWORD");
  my $sql="select name from courses where code = $paperNumber";
  my $sth = $dbh->prepare($sql);
  $sth->execute or die ("SQL error occured\n");
  if ($sth->rows()) {
    my @row=$sth->fetchrow;
    $returnValue = $row[0];
  }
  return ('', $returnValue);
}