line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Kwiki::SOAP; |
2
|
2
|
|
|
2
|
|
41977
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
74
|
|
4
|
2
|
|
|
2
|
|
1199
|
use Kwiki::Plugin '-Base'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Kwiki::Installer '-base'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = 0.05; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
const class_title => 'generic soap retrieval'; |
10
|
|
|
|
|
|
|
const class_id => 'soap_access'; |
11
|
|
|
|
|
|
|
const css_file => 'soap.css'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub register { |
14
|
|
|
|
|
|
|
my $registry = shift; |
15
|
|
|
|
|
|
|
$registry->add(template => 'base_soap.html'); |
16
|
|
|
|
|
|
|
$registry->add(wafl => soap => 'Kwiki::SOAP::Wafl'); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub soap { |
20
|
|
|
|
|
|
|
require SOAP::Lite; |
21
|
|
|
|
|
|
|
my $wsdl = shift; |
22
|
|
|
|
|
|
|
my $method = shift; |
23
|
|
|
|
|
|
|
my $args_list = shift; |
24
|
|
|
|
|
|
|
my $soap; |
25
|
|
|
|
|
|
|
my $result; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
eval { |
28
|
|
|
|
|
|
|
$soap = SOAP::Lite->service($wsdl); |
29
|
|
|
|
|
|
|
$result = $soap->$method(@$args_list); |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
if ($@) { |
32
|
|
|
|
|
|
|
return {error => (split(/\n/,$@))[0]}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
return $result; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
package Kwiki::SOAP::Wafl; |
38
|
|
|
|
|
|
|
use base 'Spoon::Formatter::WaflPhrase'; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# XXX move most of this up into the top package |
41
|
|
|
|
|
|
|
# and break it up so tests can access it and |
42
|
|
|
|
|
|
|
# some of the soap stuff can be wrapped in evals |
43
|
|
|
|
|
|
|
# to trap errors (which cause death at the moment) |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub html { |
46
|
|
|
|
|
|
|
my ($wsdl, $method, @args) = split(' ', $self->arguments); |
47
|
|
|
|
|
|
|
return $self->walf_error |
48
|
|
|
|
|
|
|
unless $method; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $result = $self->hub->soap_access->soap($wsdl, $method, \@args); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
return $self->pretty($result); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub pretty { |
56
|
|
|
|
|
|
|
require YAML; |
57
|
|
|
|
|
|
|
my $results = shift; |
58
|
|
|
|
|
|
|
$self->hub->template->process('base_soap.html', |
59
|
|
|
|
|
|
|
soap_class => $self->hub->soap_access->class_id, |
60
|
|
|
|
|
|
|
soap_output => YAML::Dump($results), |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
package Kwiki::SOAP; |
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__DATA__ |