for the RESTful ones, this is easy, i can just do content_length() on the LWP response.
content_length?! Take care, as it does not do what you might think: it just returns the value of the Content-Length header, which - of course - may be missing... or just plain wrong (as I've seen already too many wanna-be-smart web apps that have no idea about its meaning).
Is there an similar way to do this with SOAP::Lite?
Quite similar in fact, as SOAP::Lite uses the same LWP modules for HTTP transport.
The usual way to reach those HTTP::Response objects is to enable runtime tracing of transport events. Here's an example:
use strict;
use warnings;
use SOAP::Lite +trace => [
transport => sub {
my ($in) = @_;
return if ref $in ne 'HTTP::Response';
printf "Response length: %d bytes.\n", bytes::length( $in->con
+tent );
}
];
my $sv = SOAP::Lite->new->service('.../foo.wsdl');
$sv->fooMethod( 'foo', 'bar' );