| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SOAP::WSDL::Server::Simple; |
|
2
|
1
|
|
|
1
|
|
2415
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
32
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
28
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
3878
|
use Encode; |
|
|
1
|
|
|
|
|
13064
|
|
|
|
1
|
|
|
|
|
103
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1166
|
use HTTP::Request; |
|
|
1
|
|
|
|
|
22352
|
|
|
|
1
|
|
|
|
|
39
|
|
|
8
|
1
|
|
|
1
|
|
3554
|
use HTTP::Response; |
|
|
1
|
|
|
|
|
7359
|
|
|
|
1
|
|
|
|
|
35
|
|
|
9
|
1
|
|
|
1
|
|
7
|
use HTTP::Status; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
396
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use HTTP::Headers; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw(blessed); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
57
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
7
|
use Class::Std::Fast::Storable; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
14
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
170
|
use base qw(SOAP::WSDL::Server); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
153
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
7
|
use version; our $VERSION = qv('3.001'); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# mostly copied from SOAP::Lite. Unfortunately we can't use SOAP::Lite's CGI |
|
20
|
|
|
|
|
|
|
# server directly - we would have to swap out it's base class... |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
# This should be a warning for us: We should not handle methods via inheritance, |
|
23
|
|
|
|
|
|
|
# but via some plugin mechanism, to allow alternative handlers to be plugged |
|
24
|
|
|
|
|
|
|
# in. |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub handle { |
|
27
|
3
|
|
|
3
|
1
|
8306
|
my ($self, $cgi) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
3
|
|
|
|
|
4
|
my $response; |
|
30
|
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
11
|
my $content = $cgi->param('POSTDATA'); |
|
32
|
|
|
|
|
|
|
|
|
33
|
72
|
100
|
|
|
|
246
|
my $request = HTTP::Request->new( |
|
|
|
100
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$ENV{'REQUEST_METHOD'} || '' => $ENV{'SCRIPT_NAME'}, |
|
35
|
|
|
|
|
|
|
HTTP::Headers->new( |
|
36
|
|
|
|
|
|
|
map { |
|
37
|
3
|
|
50
|
|
|
87
|
(/^HTTP_(.+)/i |
|
38
|
|
|
|
|
|
|
? ($1=~m/SOAPACTION/) |
|
39
|
|
|
|
|
|
|
?('SOAPAction') |
|
40
|
|
|
|
|
|
|
:($1) |
|
41
|
|
|
|
|
|
|
: $_ |
|
42
|
|
|
|
|
|
|
) => $ENV{$_} |
|
43
|
|
|
|
|
|
|
} keys %ENV), |
|
44
|
|
|
|
|
|
|
$content, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# we copy the response message around here. |
|
48
|
|
|
|
|
|
|
# Passing by reference would be much better... |
|
49
|
3
|
|
|
|
|
4179
|
my $response_message = eval { $self->SUPER::handle($request) }; |
|
|
3
|
|
|
|
|
31
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# caveat: SOAP::WSDL::SOAP::Typelib::Fault11 is false in bool context... |
|
52
|
3
|
100
|
66
|
|
|
34
|
if ($@ || blessed $@) { |
|
53
|
2
|
|
|
|
|
6
|
my $exception = $@; |
|
54
|
2
|
|
|
|
|
21
|
$response = HTTP::Response->new(500); |
|
55
|
2
|
|
|
|
|
142
|
$response->header('Content-type' => 'text/xml; charset="utf-8"'); |
|
56
|
2
|
50
|
|
|
|
164
|
if (blessed($exception)) { |
|
57
|
0
|
|
|
|
|
0
|
$response->content( $self->get_serializer->serialize({ |
|
58
|
|
|
|
|
|
|
body => $exception |
|
59
|
|
|
|
|
|
|
}) |
|
60
|
|
|
|
|
|
|
); |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
else { |
|
63
|
2
|
|
|
|
|
15
|
$response->content($exception); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
else { |
|
67
|
1
|
|
|
|
|
8
|
$response = HTTP::Response->new(200); |
|
68
|
1
|
|
|
|
|
46
|
$response->header('Content-type' => 'text/xml; charset="utf-8"'); |
|
69
|
1
|
|
|
|
|
52
|
$response->content( encode('utf8', $response_message ) ); |
|
70
|
|
|
|
|
|
|
{ |
|
71
|
1
|
|
|
1
|
|
422
|
use bytes; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
|
1
|
|
|
|
|
64
|
|
|
72
|
1
|
|
|
|
|
5
|
$response->header('Content-length', length $response_message); |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
3
|
|
|
|
|
96
|
$self->_output($response); |
|
77
|
3
|
|
|
|
|
4771
|
return; |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub _output :PRIVATE { |
|
81
|
0
|
|
|
|
|
0
|
my ($self, $response) = @_; |
|
82
|
0
|
|
|
|
|
0
|
my $code = $response->code; |
|
83
|
0
|
|
|
|
|
0
|
binmode(STDOUT); |
|
84
|
0
|
|
|
|
|
0
|
print STDOUT "HTTP/1.0 $code ", HTTP::Status::status_message($code) |
|
85
|
|
|
|
|
|
|
, "\015\012", $response->headers_as_string("\015\012") |
|
86
|
|
|
|
|
|
|
, "\015\012", $response->content; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
0
|
warn "HTTP/1.0 $code ", HTTP::Status::status_message($code) |
|
89
|
|
|
|
|
|
|
, "\015\012", $response->headers_as_string("\015\012") |
|
90
|
|
|
|
|
|
|
, $response->content, "\n\n"; |
|
91
|
1
|
|
|
1
|
|
274
|
} |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
10
|
|
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 NAME |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
SOAP::WSDL::Server::Simple - CGI based SOAP server for HTTP::Server::Simple |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
package TestServer; |
|
104
|
|
|
|
|
|
|
use base qw(HTTP::Server::Simple::CGI); |
|
105
|
|
|
|
|
|
|
use MyServer::TestService::TestPort; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub handle_request { |
|
108
|
|
|
|
|
|
|
my ($self, $cgi) = @_; |
|
109
|
|
|
|
|
|
|
my $server = MyServer::TestService::TestPort->new({ |
|
110
|
|
|
|
|
|
|
dispatch_to => 'main', |
|
111
|
|
|
|
|
|
|
transport_class => 'SOAP::WSDL::Server::Simple', |
|
112
|
|
|
|
|
|
|
}); |
|
113
|
|
|
|
|
|
|
$server->handle($cgi); |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my $httpd = __PACKAGE__->new(); |
|
117
|
|
|
|
|
|
|
$httpd->run(); |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 USAGE |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
To use SOAP::WSDL::Server::Simple efficiently, you should first create a server |
|
122
|
|
|
|
|
|
|
interface using L. |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
SOAP::WSDL::Server::Simple dispatches all calls to appropriately named methods in the |
|
125
|
|
|
|
|
|
|
class or object set via C. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
See the generated server class on details. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Lightweight SOAP server for use with HTTP::Server::Simple, mainly designed |
|
132
|
|
|
|
|
|
|
for testing purposes. It allows to set up a simple SOAP server without having |
|
133
|
|
|
|
|
|
|
to configure CGI or mod_perl stuff. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
SOAP::WSDL::Server::Simple is not recommended for production use. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 METHODS |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head2 handle |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
See synopsis above. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Copyright 2004-2008 Martin Kutter. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
This file is part of SOAP-WSDL. You may distribute/modify it under the same |
|
148
|
|
|
|
|
|
|
terms as perl itself |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 AUTHOR |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Martin Kutter Emartin.kutter fen-net.deE |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 REPOSITORY INFORMATION |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
$Rev: 391 $ |
|
157
|
|
|
|
|
|
|
$LastChangedBy: kutterma $ |
|
158
|
|
|
|
|
|
|
$Id: Client.pm 391 2007-11-17 21:56:13Z kutterma $ |
|
159
|
|
|
|
|
|
|
$HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Client.pm $ |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |