File: TestPort.pm

package info (click to toggle)
libsoap-wsdl-perl 3.004-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (145 lines) | stat: -rw-r--r-- 3,639 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package MyServer::TestService::TestPort;
use strict;
use warnings;
use Class::Std::Fast::Storable;
use Scalar::Util qw(blessed);
use base qw(SOAP::WSDL::Client::Base);

# only load if it hasn't been loaded before
require MyTypemaps::TestService
    if not MyTypemaps::TestService->can('get_class');

my %transport_class_of :ATTR(:name<transport_class> :default<SOAP::WSDL::Server::CGI>);
my %transport_of :ATTR(:name<transport> :default<()>);
my %dispatch_to :ATTR(:name<dispatch_to>);

my $action_map_ref = {
    'http://www.example.org/benchmark/ListPerson' => 'ListPerson',

};

sub START {
    my ($self, $ident, $arg_ref) = @_;
    eval "require $transport_class_of{ $ident }" 
        or die "Cannot load transport class $transport_class_of{ $ident }: $@";
    $transport_of{ $ident } = $transport_class_of{ $ident }->new({
        action_map_ref => $action_map_ref,
        class_resolver => 'MyTypemaps::TestService',
        dispatch_to => $dispatch_to{ $ident },
    });
}

sub handle {
    $transport_of{ ${ $_[0] } }->handle();
}

1;



__END__

=pod

=head1 NAME

MyInterfaces::TestService::TestPort - SOAP Server Class for the TestService Web Service

=head1 SYNOPSIS

 use MyServer::TestService::TestPort;
 my $server = MyServer::TestService::TestPort->new({
    dispatch_to => 'My::Handler::Class',
    transport_class => 'SOAP::WSDL::Server::CGI',   # optional, default
 });
 $server->handle();


=head1 DESCRIPTION

SOAP Server handler for the TestService web service
located at http://localhost:81/soap-wsdl-test/person.pl.

=head1 SERVICE TestService



=head2 Port TestPort



=head1 METHODS

=head2 General methods

=head3 new

Constructor.

The C<dispatch_to> argument is mandatory. It must be a class or object 
implementing the SOAP Service methods listed below.

=head2 SOAP Service methods

Your dispatch_to class has to implement the following methods:

The examples below serve as copy-and-paste prototypes to use in your
class.

=head3 ListPerson



 sub ListPerson {
    my ($self, $body, $header) = @_;
    # body is a ??? object - sorry, POD not implemented yet
    # header is a ??? object - sorry, POD not implemented yet
    
    # do something with body and header...
    
    return  MyElements::ListPersonResponse->new(  {
    out =>     { # MyTypes::ArrayOfPerson
      NewElement =>       { # MyTypes::Person
        PersonID =>         { # MyTypes::PersonID
          ID =>  $some_value, # int
        },
        Salutation =>  $some_value, # string
        Name =>  $some_value, # string
        GivenName =>  $some_value, # string
        DateOfBirth =>  $some_value, # date
        HomeAddress =>         { # MyTypes::Address
          Street =>  $some_value, # string
          ZIP =>  $some_value, # string
          City =>  $some_value, # string
          Country =>  $some_value, # string
          PhoneNumber => $some_value, # PhoneNumber
          MobilePhoneNumber => $some_value, # PhoneNumber
        },
        WorkAddress =>         { # MyTypes::Address
          Street =>  $some_value, # string
          ZIP =>  $some_value, # string
          City =>  $some_value, # string
          Country =>  $some_value, # string
          PhoneNumber => $some_value, # PhoneNumber
          MobilePhoneNumber => $some_value, # PhoneNumber
        },
        Contracts =>         { # MyTypes::ArrayOfContract
          Contract =>           { # MyTypes::Contract
            ContractID =>  $some_value, # long
            ContractName =>  $some_value, # string
          },
        },
      },
    },
  },
 );

 }



=head1 AUTHOR

Generated by SOAP::WSDL on Mon Dec  3 22:20:32 2007

=pod