File Coverage

blib/lib/Catalyst/Action/SOAP/DocumentLiteral.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             { package Catalyst::Action::SOAP::DocumentLiteral;
2              
3 2     2   10946 use base 'Catalyst::Action::SOAP';
  2         5  
  2         1233  
4             use constant NS_SOAP_ENV => "http://schemas.xmlsoap.org/soap/envelope/";
5              
6             sub execute {
7             my $self = shift;
8             my ( $controller, $c ) = @_;
9             $self->prepare_soap_helper($controller,$c);
10             $self->prepare_soap_xml_post($controller,$c);
11             unless ($c->stash->{soap}->fault) {
12             my $envelope = $c->stash->{soap}->parsed_envelope;
13             my $namespace = $c->stash->{soap}->namespace || NS_SOAP_ENV;
14             my ($body) = $envelope->getElementsByTagNameNS($namespace, 'Body');
15             my $operation = $self->name;
16             $c->stash->{soap}->operation_name($operation);
17             eval {
18             if ($controller->wsdlobj) {
19             $body = $c->stash->{soap}->arguments
20             ($controller->decoders->{$operation}->($body));
21             }
22             };
23             if ($@) {
24             $c->stash->{soap}->fault
25             ({ code => 'SOAP-ENV:Client',
26             reason => 'Bad Body', detail =>
27             'Schema validation on the body failed: '.$@});
28             } else {
29             $self->next::method($controller, $c, $body);
30             }
31             }
32             }
33             };
34              
35             1;
36              
37             __END__
38              
39             =head1 NAME
40              
41             Catalyst::Action::SOAP::DocumentLiteral - Document Literal service
42              
43             =head1 SYNOPSIS
44              
45             # not used directly.
46              
47             =head1 DESCRIPTION
48              
49             This action implements a simple parse of the envelope and passing the
50             body to the service as a xml object.
51              
52             =head1 TODO
53              
54             Almost all the SOAP protocol is unsupported, only the method
55             dispatching and, optionally, the soap-decoding of the arguments are
56             made.
57              
58             =head1 AUTHORS
59              
60             Daniel Ruoso <daniel@ruoso.com>
61              
62             =head1 BUG REPORTS
63              
64             Please submit all bugs regarding C<Catalyst::Controller::SOAP> to
65             C<bug-catalyst-controller-soap@rt.cpan.org>
66              
67             =head1 LICENSE
68              
69             This library is free software, you can redistribute it and/or modify
70             it under the same terms as Perl itself.
71              
72             =cut
73