[system] / trunk / xmlrpc / modules / My / Parameters.pm Repository:
ViewVC logotype

View of /trunk/xmlrpc/modules/My/Parameters.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (download) (as text) (annotate)
Fri May 17 21:44:04 2002 UTC (17 years, 4 months ago) by gage
File size: 1489 byte(s)
Experimental xmlrpc WeBWorK webservices

    1 package My::Parameters;
    2 
    3 use vars qw(@ISA);
    4 @ISA = qw(SOAP::Server::Parameters);
    5 
    6 sub echo {
    7   my $self = shift;
    8   pop; # last parameter is envelope (SOAP::SOM object)
    9        # don't want to echo it
   10   @_;
   11 }
   12 
   13 sub echodata {
   14   my $self = shift;
   15   my @parameters = pop->dataof(SOAP::SOM::paramsin);
   16   @parameters;
   17 }
   18 
   19 sub echotwo {
   20   SOAP::Data->type(xml => "<a>$_[1]</a><b>$_[2]</b>");
   21 }
   22 
   23 sub autobind {
   24   my $self = shift;
   25   my $param1 = shift;
   26   my $param2 = SOAP::Data->name('myparam' => shift() * 2);
   27   return $param1, $param2;
   28 }
   29 
   30 sub addheader {
   31   my $self = shift;
   32   my $param1 = shift;
   33   my $header = pop->headerof(SOAP::SOM::headers);
   34   return $param1, $header->value($header->value x 2);
   35 }
   36 
   37 sub byorder {
   38   my $self = shift;
   39   my($a, $b, $c) = @_;
   40   return "1=$a, 2=$b, 3=$c";
   41 }
   42 
   43 sub byname { # input parameter(s), envelope (SOAP::SOM object)
   44   # pop() will return SOAP::SOM object
   45   # SOM->method will return structure with parameters {name => value, ...}
   46   my($a, $b, $c) = @{pop->method}{qw(a b c)};
   47   return "a=$a, b=$b, c=$c";
   48 }
   49 
   50 sub die_simply {
   51   die 'Something bad happened in our method';
   52 }
   53 
   54 sub die_with_object {
   55   die SOAP::Data->name(something => 'value')->uri('http://www.soaplite.com/');
   56 }
   57 
   58 sub die_with_fault {
   59   die SOAP::Fault->faultcode('Server.Custom') # will be qualified
   60                  ->faultstring('Died in server method')
   61                  ->faultdetail(bless {code => 1} => 'BadError')
   62                  ->faultactor('http://www.soaplite.com/custom');
   63 }
   64 
   65 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9