line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=pod |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
WSDL::Generator::Binding - Generate wsdl messages and portType for WSDL::Generator |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use WSDL::Generator::Binding; |
10
|
|
|
|
|
|
|
my $param = { 'services' => 'AcmeTravelCompany', |
11
|
|
|
|
|
|
|
'service_name' => 'Book_a_Flight' }; |
12
|
|
|
|
|
|
|
my $bind = WSDL::Generator::Binding->new($param); |
13
|
|
|
|
|
|
|
$bind->add_request('GetPrice'); |
14
|
|
|
|
|
|
|
$bind->add_response('GetPrice'); |
15
|
|
|
|
|
|
|
print $bind->get_message->to_string; |
16
|
|
|
|
|
|
|
print $bind->get_porttype->to_string; |
17
|
|
|
|
|
|
|
print $bind->get_binding->to_string; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
package WSDL::Generator::Binding; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
34
|
|
23
|
1
|
|
|
1
|
|
5
|
use warnings::register; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
103
|
|
24
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
25
|
1
|
|
|
1
|
|
4
|
use base qw(WSDL::Generator::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
779
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=pod |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 new($param) |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$param = { 'services' => 'AcmeTravelCompany', |
36
|
|
|
|
|
|
|
'service_name' => 'Book_a_Flight' }; |
37
|
|
|
|
|
|
|
$param is optional. |
38
|
|
|
|
|
|
|
Returns WSDL::Generator::Binding object |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
sub new { |
42
|
1
|
|
|
1
|
1
|
3
|
my ($class, $param) = @_; |
43
|
1
|
|
|
|
|
6
|
my $self = { 'services' => $param->{services}, |
44
|
|
|
|
|
|
|
'service_name' => $param->{service_name}, |
45
|
|
|
|
|
|
|
'methods' => {} }; |
46
|
1
|
|
|
|
|
5
|
return bless $self => $class; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=pod |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 METHODS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 add_request($method) |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Adds a method with its request for binding |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
sub add_request : method { |
59
|
3
|
|
|
3
|
1
|
6
|
my ($self, $method) = @_; |
60
|
3
|
|
|
|
|
19
|
$self->{methods}->{$method}->{request} = $method.'Request'; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 add_reponse($method) |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Adds a method with its response for binding |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
70
|
|
|
|
|
|
|
sub add_response : method { |
71
|
3
|
|
|
3
|
0
|
4
|
my ($self, $method) = @_; |
72
|
3
|
|
|
|
|
13
|
$self->{methods}->{$method}->{response} = $method.'Response'; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 generate($param) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
$param = { 'services' => 'AcmeTravelCompany', |
80
|
|
|
|
|
|
|
'service_name' => 'Book_a_Flight' }; |
81
|
|
|
|
|
|
|
$param is optional. |
82
|
|
|
|
|
|
|
Prepare a wsdl structure ready to be fetched |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
sub generate : method { |
86
|
1
|
|
|
1
|
1
|
2
|
my ($self, $param) = @_; |
87
|
1
|
|
|
|
|
2
|
my @message = (); |
88
|
1
|
|
|
|
|
2
|
my @porttype = (); |
89
|
1
|
|
|
|
|
2
|
my @binding = (); |
90
|
1
|
50
|
|
|
|
4
|
$self->{service_name} = $param->{service_name} if (exists $param->{service_name}); |
91
|
1
|
50
|
|
|
|
3
|
$self->{services} = $param->{services} if (exists $param->{services}); |
92
|
1
|
50
|
|
|
|
4
|
$self->{service_name} or return carp 'No service defined'; |
93
|
1
|
50
|
|
|
|
6
|
$self->{services} or return carp 'No services name defined'; |
94
|
1
|
|
|
|
|
1
|
foreach my $method (sort keys %{$self->{methods}} ) { |
|
1
|
|
|
|
|
10
|
|
95
|
3
|
50
|
|
|
|
4
|
push @message, @{$self->get_wsdl_element( { wsdl_type => 'MESSAGE', |
|
3
|
|
|
|
|
30
|
|
96
|
|
|
|
|
|
|
methodRe => $method.'Request', |
97
|
|
|
|
|
|
|
type => $self->{methods}->{$method}->{request}, |
98
|
|
|
|
|
|
|
} ) if ($self->{methods}->{$method}->{request})}; |
99
|
3
|
50
|
|
|
|
14
|
push @message, @{$self->get_wsdl_element( { wsdl_type => 'MESSAGE', |
|
3
|
|
|
|
|
27
|
|
100
|
|
|
|
|
|
|
methodRe => $method.'Response', |
101
|
|
|
|
|
|
|
type => $self->{methods}->{$method}->{response}, |
102
|
|
|
|
|
|
|
} ) if ($self->{methods}->{$method}->{response})}; |
103
|
3
|
|
|
|
|
8
|
push @porttype, @{$self->get_wsdl_element( { wsdl_type => 'PORTTYPE_OPERATION', |
|
3
|
|
|
|
|
22
|
|
104
|
|
|
|
|
|
|
method => $method, |
105
|
|
|
|
|
|
|
request => $method.'Request', |
106
|
|
|
|
|
|
|
response => $method.'Response', |
107
|
|
|
|
|
|
|
} )}; |
108
|
3
|
|
|
|
|
10
|
push @binding, @{$self->get_wsdl_element( { wsdl_type => 'BINDING_OPERATION', |
|
3
|
|
|
|
|
14
|
|
109
|
|
|
|
|
|
|
method => $method, |
110
|
|
|
|
|
|
|
definition_name => $self->{service_name}, |
111
|
|
|
|
|
|
|
} )}; |
112
|
|
|
|
|
|
|
} |
113
|
1
|
|
|
|
|
4
|
$self->{message} = bless \@message => ref($self); |
114
|
1
|
|
|
|
|
9
|
$self->{binding} = $self->get_wsdl_element( { wsdl_type => 'BINDING', |
115
|
|
|
|
|
|
|
binding_operation => \@binding, |
116
|
|
|
|
|
|
|
%$self, |
117
|
|
|
|
|
|
|
} ); |
118
|
1
|
|
|
|
|
15
|
$self->{porttype} = $self->get_wsdl_element( { wsdl_type => 'PORTTYPE', |
119
|
|
|
|
|
|
|
porttype_operation => \@porttype, |
120
|
|
|
|
|
|
|
%$self, |
121
|
|
|
|
|
|
|
} ); |
122
|
1
|
|
|
|
|
16
|
return $self; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=pod |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 get_message() |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Returns WSDL message object |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
sub get_message : method { |
134
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
135
|
1
|
50
|
|
|
|
7
|
exists $self->{message} or $self->generate; |
136
|
1
|
|
|
|
|
4
|
return $self->{message}; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=pod |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 get_porttype() |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Returns WSDL porttype object |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
sub get_porttype : method { |
148
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
149
|
1
|
50
|
|
|
|
5
|
exists $self->{porttype} or $self->generate; |
150
|
1
|
|
|
|
|
4
|
return $self->{porttype}; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=pod |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 get_binding() |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Returns WSDL binding object |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
sub get_binding : method { |
162
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
163
|
1
|
50
|
|
|
|
4
|
exists $self->{binding} or $self->generate; |
164
|
1
|
|
|
|
|
4
|
return $self->{binding}; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
1; |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=pod |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=head1 SEE ALSO |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
WSDL::Generator |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head1 AUTHOR |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
"Pierre Denis" |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 COPYRIGHT |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Copyright (C) 2001, Fotango Ltd - All rights reserved. |
182
|
|
|
|
|
|
|
This is free software. This software may be modified and/or distributed under the same terms as Perl itself. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=cut |