Clean up/consolidated code sample
 
#!/usr/bin/perl
#
# SOAP::Lite server HOWTO
#
# Author: Byrne Reese <byrne@majordojo.com>
#
###################################################
 
use SOAP::Transport::HTTP;
 
SOAP::Transport::HTTP::CGI
->dispatch_to('Echo')
->handle;
 
BEGIN {
package Echo;
use strict;
use vars qw(@ISA);
@ISA = qw(SOAP::Server::Parameters);
sub echo {
my $self = shift;
my $envelope = pop;
my $str = $envelope->dataof("//echo/whatToEcho")
or die SOAP::Fault->faultcode("Client")
->faultstring("String to echo was not specified")
->faultactor('urn:Echo');
return SOAP::Data->name("whatWasEchoed" => $str->value);
}
1;
}