package WorldFunctions;
sub new { bless {}, shift; }
sub Hello { my ($s, $name) = @_;
return 'Hello, ' . $name . "\n";
}
sub GoodBye { my ($s, $name) = @_;
return 'Goodbye, ' . $name . "\n";
}
1;
####
package CLASS::World;
use SOAP::Transport::HTTP;
my $server = SOAP::Transport::HTTP::Apache ->
dispatch_to('WorldFunctions');
sub handler { $server->handler(@_); }
package WorldFunctions;
sub new { bless {}, shift; }
sub Hello { my ($s, $name) = @_;
return 'Hello, ' . $name . "\n";
}
sub GoodBye { my ($s, $name) = @_;
return 'Goodbye, ' . $name . "\n";
}
1;
####
use WSDL::Generator;
my $init = {
'schema_namesp' => 'http://localhost/WorldFunctions.xsd',
'services' => 'WorldFunctions',
'service_name' => 'WorldFunctions',
'target_namesp' => 'http://localhost/world/',
'documentation' => 'Simple Hello World SOAP Service.',
'location' => 'http://localhost/world
};
my $w = WSDL::Generator->new($init);
WorldFunctions->Hello('Joe');
WorldFunctions->GoodBye('Joe');
print $w->get(WorldFunctions);