1package MyServer::HelloWorld::HelloWorldSoap;
2use strict;
3use warnings;
4use Class::Std::Fast::Storable;
5use Scalar::Util qw(blessed);
6use base qw(SOAP::WSDL::Client::Base);
7
8# only load if it hasn't been loaded before
9require MyTypemaps::HelloWorld
10    if not MyTypemaps::HelloWorld->can('get_class');
11
12my %transport_class_of :ATTR(:name<transport_class> :default<SOAP::WSDL::Server::CGI>);
13my %transport_of :ATTR(:name<transport> :default<()>);
14my %dispatch_to :ATTR(:name<dispatch_to>);
15
16my $action_map_ref = {
17    'urn:HelloWorld#sayHello' => 'sayHello',
18};
19
20sub START {
21    my ($self, $ident, $arg_ref) = @_;
22    eval "require $transport_class_of{ $ident }"
23        or die "Cannot load transport class $transport_class_of{ $ident }: $@";
24    $transport_of{ $ident } = $transport_class_of{ $ident }->new({
25        action_map_ref => $action_map_ref,
26        class_resolver => 'MyTypemaps::HelloWorld',
27        dispatch_to => $dispatch_to{ $ident },
28    });
29}
30
31sub handle {
32    $transport_of{ ${ $_[0] } }->handle(@_[1..$#_]);
33}
34
351;
36
37
38
39__END__
40
41=pod
42
43=head1 NAME
44
45MyInterfaces::HelloWorld::HelloWorldSoap - SOAP Server Class for the HelloWorld Web Service
46
47=head1 SYNOPSIS
48
49 use MyServer::HelloWorld::HelloWorldSoap;
50 my $server = MyServer::HelloWorld::HelloWorldSoap->new({
51    dispatch_to => 'My::Handler::Class',
52    transport_class => 'SOAP::WSDL::Server::CGI',   # optional, default
53 });
54 $server->handle();
55
56
57=head1 DESCRIPTION
58
59SOAP Server handler for the HelloWorld web service
60located at http://localhost:81/soap-wsdl-test/helloworld.pl.
61
62=head1 SERVICE HelloWorld
63
64
65
66=head2 Port HelloWorldSoap
67
68
69
70=head1 METHODS
71
72=head2 General methods
73
74=head3 new
75
76Constructor.
77
78The C<dispatch_to> argument is mandatory. It must be a class or object
79implementing the SOAP Service methods listed below.
80
81=head2 SOAP Service methods
82
83Your dispatch_to class has to implement the following methods:
84
85The examples below serve as copy-and-paste prototypes to use in your
86class.
87
88=head3 sayHello
89
90
91
92 sub sayHello(
93    my ($self, $body, $header) = @_;
94    # body is a ??? object - sorry, POD not implemented yet
95    # header is a ??? object - sorry, POD not implemented yet
96
97    # do something with body and header...
98
99    return  MyElements::sayHelloResponse->new(  {
100    sayHelloResult =>  $some_value, # string
101  },
102 );
103
104 }
105
106
107
108=head1 AUTHOR
109
110Generated by SOAP::WSDL on Sun Dec  2 01:20:36 2007
111
112=pod