line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
{ package Catalyst::Action::SOAP; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use base 'Catalyst::Action'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1156
|
|
4
|
2
|
|
|
2
|
|
3555
|
use XML::LibXML; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw/xml_parser/); |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
|
|
|
|
|
|
my $class = shift; |
10
|
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
11
|
|
|
|
|
|
|
$self->xml_parser(XML::LibXML->new()); |
12
|
|
|
|
|
|
|
return $self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub prepare_soap_helper { |
16
|
|
|
|
|
|
|
my ($self, $controller, $c) = @_; |
17
|
|
|
|
|
|
|
$c->stash->{soap} = Catalyst::Controller::SOAP::Helper->new(); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub prepare_soap_xml_post { |
21
|
|
|
|
|
|
|
my ($self, $controller, $c) = @_; |
22
|
|
|
|
|
|
|
# This should be application/soap+xml, but some clients doesn't seem to respect that. |
23
|
|
|
|
|
|
|
if ($c->req->content_type =~ /xml/ && |
24
|
|
|
|
|
|
|
$c->req->method eq 'POST') { |
25
|
|
|
|
|
|
|
my $body = $c->req->body; |
26
|
|
|
|
|
|
|
my $xml_str = ref $body ? (join '', <$body>) : $body; |
27
|
|
|
|
|
|
|
$c->log->debug("Incoming XML: $xml_str") if $c->debug; |
28
|
|
|
|
|
|
|
eval { |
29
|
|
|
|
|
|
|
$c->stash->{soap}->envelope($xml_str); |
30
|
|
|
|
|
|
|
$c->stash->{soap}->parsed_envelope($self->xml_parser->parse_string($xml_str)); |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
if ($@) { |
33
|
|
|
|
|
|
|
$c->stash->{soap}->fault({ code => 'SOAP-ENV:Client', reason => 'Bad XML Message', detail => $@}); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} else { |
36
|
|
|
|
|
|
|
$c->stash->{soap}->fault({ code => 'SOAP-ENV:Client', reason => 'Bad content-type/method'}); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
Catalyst::Action::SOAP - Action superclass |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# not used directly. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
This is the superclass used by the Document and the RPC actions. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 TODO |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Almost all the SOAP protocol is unsupported, only the method |
60
|
|
|
|
|
|
|
dispatching and, optionally, the soap-decoding of the arguments are |
61
|
|
|
|
|
|
|
made. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHORS |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Daniel Ruoso <daniel@ruoso.com> |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 BUG REPORTS |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Please submit all bugs regarding C<Catalyst::Controller::SOAP> to |
70
|
|
|
|
|
|
|
C<bug-catalyst-controller-soap@rt.cpan.org> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 LICENSE |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This library is free software, you can redistribute it and/or modify |
75
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|