File Coverage

blib/lib/W3C/SOAP/WSDL/Document/Message.pm
Criterion Covered Total %
statement 27 52 51.9
branch 0 12 0.0
condition n/a
subroutine 9 11 81.8
pod n/a
total 36 75 48.0


line stmt bran cond sub pod time code
1             package W3C::SOAP::WSDL::Document::Message;
2              
3             # Created on: 2012-05-27 19:25:15
4             # Create by: Ivan Wills
5             # $Id$
6             # $Revision$, $HeadURL$, $Date$
7             # $Revision$, $Source$, $Date$
8              
9 1     1   1036 use Moose;
  1         2  
  1         7  
10 1     1   3158 use warnings;
  1         2  
  1         24  
11 1     1   3 use version;
  1         2  
  1         5  
12 1     1   65 use Carp;
  1         2  
  1         53  
13 1     1   4 use Scalar::Util;
  1         3  
  1         29  
14 1     1   5 use List::Util;
  1         1  
  1         39  
15             #use List::MoreUtils;
16 1     1   4 use Data::Dumper qw/Dumper/;
  1         2  
  1         39  
17 1     1   4 use English qw/ -no_match_vars /;
  1         2  
  1         6  
18 1     1   332 use W3C::SOAP::Utils qw/split_ns xml_error cmp_ns/;
  1         3  
  1         7  
19              
20             extends 'W3C::SOAP::Document::Node';
21              
22             our $VERSION = version->new('0.11');
23              
24             has element => (
25             is => 'rw',
26             isa => 'Maybe[W3C::SOAP::XSD::Document::Element]',
27             builder => '_element',
28             lazy => 1,
29             );
30             has type => (
31             is => 'rw',
32             isa => 'Maybe[Str]',
33             builder => '_type',
34             lazy => 1,
35             );
36              
37             sub _element {
38 0     0     my ($self) = @_;
39 0           my ($part) = $self->document->xpc->findnodes("wsdl:part", $self->node);
40 0 0         return unless $part;
41 0           my $element = $part->getAttribute('element');
42 0 0         return unless $element;
43              
44 0           my ($ns, $el_name) = split_ns($element);
45 0           my $nsuri = $self->document->get_nsuri($ns);
46 0           my @schemas = @{ $self->document->schemas };
  0            
47              
48 0           for my $schema (@schemas) {
49 0           push @schemas, @{ $schema->imports };
  0            
50 0           push @schemas, @{ $schema->includes };
  0            
51              
52 0 0         if ( cmp_ns($schema->target_namespace, $nsuri) ) {
53 0           for my $element (@{ $schema->elements }) {
  0            
54 0 0         return $element if $element->name eq $el_name;
55             }
56             }
57             }
58              
59 0           return;
60             }
61              
62             sub _type {
63 0     0     my ($self) = @_;
64 0           my ($part) = $self->document->xpc->findnodes("wsdl:part", $self->node);
65 0 0         return unless $part;
66 0           my $type = $part->getAttribute('type');
67 0 0         return unless $type;
68              
69 0           return $type;
70             }
71              
72             1;
73              
74             __END__
75              
76             =head1 NAME
77              
78             W3C::SOAP::WSDL::Document::Message - Representation of SOAP messages in a WSDL document
79              
80             =head1 VERSION
81              
82             This documentation refers to W3C::SOAP::WSDL::Document::Message version 0.11.
83              
84              
85             =head1 SYNOPSIS
86              
87             use W3C::SOAP::WSDL::Document::Message;
88              
89             # Brief but working code example(s) here showing the most common usage(s)
90             # This section will be as far as many users bother reading, so make it as
91             # educational and exemplary as possible.
92              
93              
94             =head1 DESCRIPTION
95              
96             A C<W3C::SOAP::WSDL::Document::Message> object represents the messages tags
97             in a WSDL document.
98              
99             =head1 SUBROUTINES/METHODS
100              
101             =over 4
102              
103             =back
104              
105             =head1 DIAGNOSTICS
106              
107             =head1 CONFIGURATION AND ENVIRONMENT
108              
109             =head1 DEPENDENCIES
110              
111             =head1 INCOMPATIBILITIES
112              
113             =head1 BUGS AND LIMITATIONS
114              
115             There are no known bugs in this module.
116              
117             Please report problems to Ivan Wills (ivan.wills@gmail.com).
118              
119             Patches are welcome.
120              
121             =head1 AUTHOR
122              
123             Ivan Wills - (ivan.wills@gmail.com)
124              
125             =head1 LICENSE AND COPYRIGHT
126              
127             Copyright (c) 2012 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
128             All rights reserved.
129              
130             This module is free software; you can redistribute it and/or modify it under
131             the same terms as Perl itself. See L<perlartistic>. This program is
132             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
133             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
134             PARTICULAR PURPOSE.
135              
136             =cut