line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SOAP::WSDL::Generator::Iterator::WSDL11; |
2
|
1
|
|
|
1
|
|
594
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
5
|
use Class::Std::Fast; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = 3.003; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my %definitions_of :ATTR(:name :default<[]>); |
8
|
|
|
|
|
|
|
my %nodes_of :ATTR(:name :default<[]>); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# memoization attributes |
11
|
|
|
|
|
|
|
my %portType_of :ATTR(); |
12
|
|
|
|
|
|
|
my %types_of :ATTR(); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %METHOD_OF = ( |
15
|
|
|
|
|
|
|
'SOAP::WSDL::Definitions' => 'get_service', |
16
|
|
|
|
|
|
|
'SOAP::WSDL::Service' => 'get_port', |
17
|
|
|
|
|
|
|
'SOAP::WSDL::Port' => sub { |
18
|
|
|
|
|
|
|
my ($self, $node) = @_; |
19
|
|
|
|
|
|
|
return if ! $node->first_address() |
20
|
|
|
|
|
|
|
or ! $node->first_address()->isa('SOAP::WSDL::SOAP::Address'); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return [ $self->get_definitions() |
23
|
|
|
|
|
|
|
->find_binding( $node->expand( $node->get_binding() ) ) || () ]; |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
'SOAP::WSDL::Binding' => sub { |
27
|
|
|
|
|
|
|
my ($self, $node) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# remember referenced portType |
30
|
|
|
|
|
|
|
$portType_of{ ident $self } = $self->get_definitions() |
31
|
|
|
|
|
|
|
->find_portType( $node->expand( $node->get_type ) ) |
32
|
|
|
|
|
|
|
or return []; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return $node->get_operation(); |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
'SOAP::WSDL::Operation' => sub { |
38
|
|
|
|
|
|
|
my ($self, $node) = @_; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $name = $node->get_name(); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# get the equally named operation from the portType |
43
|
|
|
|
|
|
|
my ($op) = grep { $_->get_name() eq $name } |
44
|
|
|
|
|
|
|
@{ $portType_of{ ident $self }->get_operation() } |
45
|
|
|
|
|
|
|
or return []; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return [ @{ $op->get_input }, @{ $op->get_output }, @{ $op->get_fault } ] |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
'SOAP::WSDL::OpMessage' => sub { |
51
|
|
|
|
|
|
|
my ($self, $node) = @_; |
52
|
|
|
|
|
|
|
return if ( ref $node->get_parent() eq 'SOAP::WSDL::Binding' ); # we're in binding |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# TODO maybe allow more messages && overloading by specifying name |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
return [ $self->get_definitions()->find_message( |
57
|
|
|
|
|
|
|
$node->expand( $node->get_message() ) |
58
|
|
|
|
|
|
|
) || () ]; |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
'SOAP::WSDL::Message' => 'get_part', |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
'SOAP::WSDL::Part' => sub { |
64
|
|
|
|
|
|
|
my ($self, $node) = @_; |
65
|
|
|
|
|
|
|
my $ident = ident $self; |
66
|
|
|
|
|
|
|
my $types = $types_of{ $ident } = $definitions_of{ $ident }->get_types()->[0] |
67
|
|
|
|
|
|
|
or return []; |
68
|
|
|
|
|
|
|
return [ |
69
|
|
|
|
|
|
|
# If we have a type, this type is to be used in document/literal |
70
|
|
|
|
|
|
|
# as global type. However this is forbidden, at least by WS-I. |
71
|
|
|
|
|
|
|
# We should store the style/encoding somewhere, and regard it. |
72
|
|
|
|
|
|
|
# TODO: auto-generate element for RPC bindings |
73
|
|
|
|
|
|
|
$node->get_type() |
74
|
|
|
|
|
|
|
? do { |
75
|
|
|
|
|
|
|
die "unsupported global type <" |
76
|
|
|
|
|
|
|
. $node->get_type . "> found in part <". $node->get_name() . ">\n" |
77
|
|
|
|
|
|
|
. "Looks like a rpc/literal WSDL, which is not supported by SOAP::WSDL\n"; |
78
|
|
|
|
|
|
|
## use this once we can auto-generate an element for RPC bindings |
79
|
|
|
|
|
|
|
# $types->find_type( $node->expand($node->get_type) ) |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
: (), |
82
|
|
|
|
|
|
|
$node->get_element() |
83
|
|
|
|
|
|
|
? $types->find_element( $node->expand($node->get_element) ) |
84
|
|
|
|
|
|
|
: (), |
85
|
|
|
|
|
|
|
]; |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub init { |
90
|
0
|
|
|
0
|
0
|
|
my ($self, $arg_of) = @_; |
91
|
0
|
|
|
|
|
|
my $ident = ident $self; |
92
|
0
|
|
|
|
|
|
undef $portType_of{ $ident }; |
93
|
0
|
|
|
|
|
|
undef $types_of{ $ident }; |
94
|
|
|
|
|
|
|
$nodes_of{ $ident } = [ |
95
|
|
|
|
|
|
|
exists($arg_of->{ node }) |
96
|
|
|
|
|
|
|
? $arg_of->{ node } |
97
|
0
|
0
|
|
|
|
|
: $definitions_of{ ident $self } |
98
|
|
|
|
|
|
|
]; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
sub get_next { |
102
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
103
|
0
|
|
|
|
|
|
my $ident = ident $self; |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $node = shift @{ $nodes_of{ $ident }}; |
|
0
|
|
|
|
|
|
|
106
|
0
|
0
|
|
|
|
|
return if ! defined $node; |
107
|
|
|
|
|
|
|
|
108
|
0
|
0
|
|
|
|
|
unshift @{ $nodes_of{ $ident }}, @{ $self->get_nextNodes( $node ) || [] }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
return $node; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub get_nextNodes { |
114
|
0
|
|
|
0
|
0
|
|
my ($self, $node) = @_; |
115
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
|
my $method = $METHOD_OF{ ref $node } |
117
|
|
|
|
|
|
|
or return []; |
118
|
|
|
|
|
|
|
|
119
|
0
|
0
|
|
|
|
|
return (ref($method) eq 'CODE') |
120
|
|
|
|
|
|
|
? $method->( $self, $node ) |
121
|
|
|
|
|
|
|
: $node->can($method)->( $node ); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
__END__ |