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