« blib/lib/W3C/SOAP/WSDL/Document/Binding.pm
↑ Summary
blib/lib/W3C/SOAP/Header/Security/Username.pm »
| 1 | package W3C::SOAP::WSDL::Document::Operation; | ||||||||||
| 2 | |||||||||||
| 3 | # Created on: 2012-05-28 07:03:06 | ||||||||||
| 4 | # Create by: Ivan Wills | ||||||||||
| 5 | # $Id$ | ||||||||||
| 6 | # $Revision$, $HeadURL$, $Date$ | ||||||||||
| 7 | # $Revision$, $Source$, $Date$ | ||||||||||
| 8 | |||||||||||
| 9 | 5 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 5 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 5 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 5 | ▶ | use Scalar::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 5 | ▶ | use List::Util; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | #use List::MoreUtils; | ||||||||||
| 15 | 5 | ▶ | use Data::Dumper qw/Dumper/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 5 | ▶ | use English qw/ -no_match_vars /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 5 | ▶ | use W3C::SOAP::WSDL::Document::InOutPuts; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 5 | extends 'W3C::SOAP::Document::Node'; | |||||||||
| 20 | |||||||||||
| 21 | 5 | our $VERSION = 0.13; | |||||||||
| 22 | |||||||||||
| 23 | 5 | has style => ( | |||||||||
| 24 | is => 'rw', | ||||||||||
| 25 | isa => 'Str', | ||||||||||
| 26 | builder => '_style', | ||||||||||
| 27 | lazy => 1, | ||||||||||
| 28 | ); | ||||||||||
| 29 | 5 | has action => ( | |||||||||
| 30 | is => 'rw', | ||||||||||
| 31 | isa => 'Str', | ||||||||||
| 32 | builder => '_action', | ||||||||||
| 33 | lazy => 1, | ||||||||||
| 34 | ); | ||||||||||
| 35 | 5 | has inputs => ( | |||||||||
| 36 | is => 'rw', | ||||||||||
| 37 | isa => 'ArrayRef[W3C::SOAP::WSDL::Document::InOutPuts]', | ||||||||||
| 38 | builder => '_inputs', | ||||||||||
| 39 | lazy => 1, | ||||||||||
| 40 | ); | ||||||||||
| 41 | 5 | has outputs => ( | |||||||||
| 42 | is => 'rw', | ||||||||||
| 43 | isa => 'ArrayRef[W3C::SOAP::WSDL::Document::InOutPuts]', | ||||||||||
| 44 | builder => '_outputs', | ||||||||||
| 45 | lazy => 1, | ||||||||||
| 46 | ); | ||||||||||
| 47 | 5 | has faults => ( | |||||||||
| 48 | is => 'rw', | ||||||||||
| 49 | isa => 'ArrayRef[W3C::SOAP::WSDL::Document::InOutPuts]', | ||||||||||
| 50 | builder => '_faults', | ||||||||||
| 51 | lazy => 1, | ||||||||||
| 52 | ); | ||||||||||
| 53 | 5 | has port_type => ( | |||||||||
| 54 | is => 'rw', | ||||||||||
| 55 | isa => 'W3C::SOAP::WSDL::Document::Operation', | ||||||||||
| 56 | builder => '_port_type', | ||||||||||
| 57 | lazy => 1, | ||||||||||
| 58 | ); | ||||||||||
| 59 | |||||||||||
| 60 | # If this operation was from the C<port_type> then this would be the | ||||||||||
| 61 | # one derived from the binding. | ||||||||||
| 62 | 5 | has binding_operation => ( | |||||||||
| 63 | is => 'rw', | ||||||||||
| 64 | isa => 'Maybe[W3C::SOAP::WSDL::Document::Operation]', | ||||||||||
| 65 | predicate => 'has_binding_operation', | ||||||||||
| 66 | ); | ||||||||||
| 67 | |||||||||||
| 68 | sub _style { | ||||||||||
| 69 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_style: called CC=4 SCAR=16.6
| |||||||||||
| 70 | |||||||||||
| 71 | 1 | my $style = $self->node->getAttribute('style'); | |||||||||
| 72 | 1 | ▶ | if ( !defined $style ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 73 | 1 | ▶ | if ( my ($child) = $self->_soap_binding_node() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 74 | 1 | $style = $child->getAttribute('style'); | |||||||||
| 75 | } | ||||||||||
| 76 | else { | ||||||||||
| 77 | 0 | ▶ | if ( my ($child) = $self->_soap_operation_node() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 78 | 0 | $style = $child->getAttribute('style'); | |||||||||
| 79 | } | ||||||||||
| 80 | } | ||||||||||
| 81 | } | ||||||||||
| 82 | |||||||||||
| 83 | 1 | return $style | |||||||||
| 84 | } | ||||||||||
| 85 | |||||||||||
| 86 | sub _action { | ||||||||||
| 87 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_action: called CC=3 SCAR=11.2
| |||||||||||
| 88 | |||||||||||
| 89 | 1 | my $action = $self->node->getAttribute('soapAction'); | |||||||||
| 90 | 1 | ▶ | if ( !defined $action ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 91 | 1 | ▶ | if ( my ($child) = $self->_soap_operation_node() ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | 1 | $action = $child->getAttribute('soapAction'); | |||||||||
| 93 | } | ||||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 1 | return $action; | |||||||||
| 97 | } | ||||||||||
| 98 | |||||||||||
| 99 | sub _soap_operation_node { | ||||||||||
| 100 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_soap_operation_node: called CC=1 SCAR=0.0
| |||||||||||
| 101 | |||||||||||
| 102 | 1 | return $self->document->xpc->findnodes('soap:operation', $self->node); | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | sub _soap_binding_node { | ||||||||||
| 106 | 1 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_soap_binding_node: called CC=1 SCAR=0.0
| |||||||||||
| 107 | |||||||||||
| 108 | 1 | return $self->document->xpc->findnodes('../soap:binding', $self->node); | |||||||||
| 109 | } | ||||||||||
| 110 | |||||||||||
| 111 | 7 | ▶ | sub _inputs { return $_[0]->_in_out_puts('input'); } | ||||||||
|
Subroutine
_inputs: called CC=1 SCAR=0.0
| |||||||||||
| 112 | 6 | ▶ | sub _outputs { return $_[0]->_in_out_puts('output'); } | ||||||||
|
Subroutine
_outputs: called CC=1 SCAR=0.0
| |||||||||||
| 113 | 6 | ▶ | sub _faults { return $_[0]->_in_out_puts('fault'); } | ||||||||
|
Subroutine
_faults: called CC=1 SCAR=0.0
| |||||||||||
| 114 | sub _in_out_puts { | ||||||||||
| 115 | 19 | ▶ | my ($self, $dir) = @_; | ||||||||
|
Subroutine
_in_out_puts: called CC=2 SCAR=6.9
| |||||||||||
| 116 | 19 | my @puts; | |||||||||
| 117 | 19 | my @nodes = $self->document->xpc->findnodes("wsdl:$dir", $self->node); | |||||||||
| 118 | |||||||||||
| 119 | 19 | for my $node (@nodes) { | |||||||||
| 120 | 13 | push @puts, W3C::SOAP::WSDL::Document::InOutPuts->new( | |||||||||
| 121 | parent_node => $self, | ||||||||||
| 122 | node => $node, | ||||||||||
| 123 | dir => $dir, | ||||||||||
| 124 | ); | ||||||||||
| 125 | } | ||||||||||
| 126 | |||||||||||
| 127 | 19 | return \@puts; | |||||||||
| 128 | } | ||||||||||
| 129 | |||||||||||
| 130 | sub _port_type { | ||||||||||
| 131 | 6 | ▶ | my ($self) = @_; | ||||||||
|
Subroutine
_port_type: called CC=4 SCAR=13.9
| |||||||||||
| 132 | |||||||||||
| 133 | 6 | my $ret; | |||||||||
| 134 | |||||||||||
| 135 | PORT_TYPE: | ||||||||||
| 136 | 6 | for my $port_type (@{ $self->document->port_types }) { | |||||||||
| 137 | 6 | for my $operation (@{ $port_type->operations }) { | |||||||||
| 138 | 12 | ▶ | if ( $operation->name eq $self->name ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 139 | 6 | $ret = $operation; | |||||||||
| 140 | 6 | $ret->binding_operation($self); | |||||||||
| 141 | } | ||||||||||
| 142 | } | ||||||||||
| 143 | } | ||||||||||
| 144 | 6 | return $ret; | |||||||||
| 145 | } | ||||||||||
| 146 | |||||||||||
| 147 | 5 | 1; | |||||||||
| 148 | |||||||||||
| 149 | __END__ | ||||||||||
| 150 | |||||||||||
| 151 | =head1 NAME | ||||||||||
| 152 | |||||||||||
| 153 | W3C::SOAP::WSDL::Document::Operation - Represents the operations in a WSDL document | ||||||||||
| 154 | |||||||||||
| 155 | =head1 VERSION | ||||||||||
| 156 | |||||||||||
| 157 | This documentation refers to W3C::SOAP::WSDL::Document::Operation version 0.13. | ||||||||||
| 158 | |||||||||||
| 159 | |||||||||||
| 160 | =head1 SYNOPSIS | ||||||||||
| 161 | |||||||||||
| 162 | use W3C::SOAP::WSDL::Document::Operation; | ||||||||||
| 163 | |||||||||||
| 164 | # Brief but working code example(s) here showing the most common usage(s) | ||||||||||
| 165 | # This section will be as far as many users bother reading, so make it as | ||||||||||
| 166 | # educational and exemplary as possible. | ||||||||||
| 167 | |||||||||||
| 168 | |||||||||||
| 169 | =head1 DESCRIPTION | ||||||||||
| 170 | |||||||||||
| 171 | A C<W3C::SOAP::WSDL::Document::Operation> object represents the operation tags | ||||||||||
| 172 | in a WSDL document. | ||||||||||
| 173 | |||||||||||
| 174 | =head1 SUBROUTINES/METHODS | ||||||||||
| 175 | |||||||||||
| 176 | =over 4 | ||||||||||
| 177 | |||||||||||
| 178 | =back | ||||||||||
| 179 | |||||||||||
| 180 | =head1 DIAGNOSTICS | ||||||||||
| 181 | |||||||||||
| 182 | =head1 CONFIGURATION AND ENVIRONMENT | ||||||||||
| 183 | |||||||||||
| 184 | =head1 DEPENDENCIES | ||||||||||
| 185 | |||||||||||
| 186 | =head1 INCOMPATIBILITIES | ||||||||||
| 187 | |||||||||||
| 188 | =head1 BUGS AND LIMITATIONS | ||||||||||
| 189 | |||||||||||
| 190 | There are no known bugs in this module. | ||||||||||
| 191 | |||||||||||
| 192 | Please report problems to Ivan Wills (ivan.wills@gmail.com). | ||||||||||
| 193 | |||||||||||
| 194 | Patches are welcome. | ||||||||||
| 195 | |||||||||||
| 196 | =head1 AUTHOR | ||||||||||
| 197 | |||||||||||
| 198 | Ivan Wills - (ivan.wills@gmail.com) | ||||||||||
| 199 | |||||||||||
| 200 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 201 | |||||||||||
| 202 | Copyright (c) 2012 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077). | ||||||||||
| 203 | All rights reserved. | ||||||||||
| 204 | |||||||||||
| 205 | This module is free software; you can redistribute it and/or modify it under | ||||||||||
| 206 | the same terms as Perl itself. See L<perlartistic>. This program is | ||||||||||
| 207 | distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | ||||||||||
| 208 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||||||||||
| 209 | PARTICULAR PURPOSE. | ||||||||||
| 210 | |||||||||||
| 211 | =cut | ||||||||||