line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package SOAP::WSDL::Transport::HTTP; |
2
|
2
|
|
|
2
|
|
26649
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
5
|
|
|
2
|
|
|
|
|
60
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
3
|
2
|
|
|
2
|
|
10
|
use base qw(LWP::UserAgent); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2255
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
126137
|
use SOAP::WSDL; # just for $SOAP::WSDL::VERSION |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = $SOAP::WSDL::VERSION; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# create methods normally inherited from SOAP::Client |
9
|
|
|
|
|
|
|
SUBFACTORY: { |
10
|
|
|
|
|
|
|
no strict qw(refs); |
11
|
|
|
|
|
|
|
foreach my $method ( qw(code message status is_success) ) { |
12
|
|
|
|
|
|
|
*{ $method } = sub { |
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
return $self->{ $method } if not @_; |
15
|
|
|
|
|
|
|
return $self->{ $method } = shift; |
16
|
|
|
|
|
|
|
}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _agent { |
21
|
|
|
|
|
|
|
return qq[SOAP::WSDL $VERSION]; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub send_receive { |
25
|
|
|
|
|
|
|
my ($self, %parameters) = @_; |
26
|
|
|
|
|
|
|
my ($envelope, $soap_action, $endpoint, $encoding, $content_type) = |
27
|
|
|
|
|
|
|
@parameters{qw(envelope action endpoint encoding content_type)}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$encoding = defined($encoding) |
30
|
|
|
|
|
|
|
? lc($encoding) |
31
|
|
|
|
|
|
|
: 'utf-8'; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$content_type = "text/xml; charset=$encoding" |
34
|
|
|
|
|
|
|
if not defined($content_type); |
35
|
|
|
|
|
|
|
# what's this all about? |
36
|
|
|
|
|
|
|
# unfortunately combination of LWP and Perl 5.6.1 and later has bug |
37
|
|
|
|
|
|
|
# in sending multibyte characters. LWP uses length() to calculate |
38
|
|
|
|
|
|
|
# content-length header and starting 5.6.1 length() calculates chars |
39
|
|
|
|
|
|
|
# instead of bytes. 'use bytes' in THIS file doesn't work, because |
40
|
|
|
|
|
|
|
# it's lexically scoped. Unfortunately, content-length we calculate |
41
|
|
|
|
|
|
|
# here doesn't work either, because LWP overwrites it with |
42
|
|
|
|
|
|
|
# content-length it calculates (which is wrong) AND uses length() |
43
|
|
|
|
|
|
|
# during syswrite/sysread, so we are in a bad shape anyway. |
44
|
|
|
|
|
|
|
# |
45
|
|
|
|
|
|
|
# what to do? we calculate proper content-length (using |
46
|
|
|
|
|
|
|
# bytelength() function from SOAP::Utils) and then drop utf8 mark |
47
|
|
|
|
|
|
|
# from string (doing pack with 'C0A*' modifier) if length and |
48
|
|
|
|
|
|
|
# bytelength are not the same |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# use bytes is lexically scoped |
51
|
|
|
|
|
|
|
my $bytelength = do { use bytes; length $envelope }; |
52
|
|
|
|
|
|
|
$envelope = pack('C0A*', $envelope) |
53
|
|
|
|
|
|
|
if length($envelope) != $bytelength; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my $request = HTTP::Request->new( 'POST', |
56
|
|
|
|
|
|
|
$endpoint, |
57
|
|
|
|
|
|
|
[ 'Content-Type', "$content_type", |
58
|
|
|
|
|
|
|
'Content-Length', $bytelength, |
59
|
|
|
|
|
|
|
'SOAPAction', $soap_action, |
60
|
|
|
|
|
|
|
], |
61
|
|
|
|
|
|
|
$envelope ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $response = $self->request( $request ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
$self->code( $response->code); |
66
|
|
|
|
|
|
|
$self->message( $response->message); |
67
|
|
|
|
|
|
|
$self->is_success($response->is_success); |
68
|
|
|
|
|
|
|
$self->status($response->status_line); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
return $response->content(); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 NAME |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
SOAP::WSDL::Transport::HTTP - Fallback http(s) transport class |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Provides a thin transport class used by SOAP::WSDL::Transport when |
84
|
|
|
|
|
|
|
SOAP::Lite is not available. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Copyright (c) 2007 Martin Kutter. All rights reserved. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This file is part of SOAP-WSDL. You may distribute/modify it under |
91
|
|
|
|
|
|
|
the same terms as perl itself |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Martin Kutter Emartin.kutter fen-net.deE |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 REPOSITORY INFORMATION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
$Rev: 851 $ |
100
|
|
|
|
|
|
|
$LastChangedBy: kutterma $ |
101
|
|
|
|
|
|
|
$Id: HTTP.pm 851 2009-05-15 22:45:18Z kutterma $ |
102
|
|
|
|
|
|
|
$HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Transport/HTTP.pm $ |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|