#!/usr/bin/perl --
use SOAP::Lite;
my $soap = SOAP::Lite
->proxy(
'http://localhost/blah/DummyService',
timeout => 0.00001,
);
$soap->transport->add_handler("request_send", \&pp_dump );
eval { $soap->fault; 1 } or print $@;
print '#' x 33, "\n";
eval { $soap->faultcode; 1 } or print $@;
print '#' x 33, "\n";
eval { $soap->faultstring; 1 } or print $@;
print '#' x 33, "\n";
$soap->call('NONSENSE');
sub pp {
use XML::Twig;
open my($fh), '>', \my $str;
no warnings 'newline';
XML::Twig->new(
qw! pretty_print record !
)->parse(
@_
)->print( $fh );
return $str;
}
sub pp_dump {
{
my $content = $_[0]->content('');
$_[0]->content( pp($content) );
}
print $_[0]->as_string,"\n";
return;
}
__END__
POST http://localhost/blah/DummyService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/0.714
Content-Length: 391
Content-Type: text/xml; charset=utf-8
SOAPAction: "#fault"
500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line 12
#################################
POST http://localhost/blah/DummyService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/0.714
Content-Length: 395
Content-Type: text/xml; charset=utf-8
SOAPAction: "#faultcode"
500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line 14
#################################
POST http://localhost/blah/DummyService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/0.714
Content-Length: 397
Content-Type: text/xml; charset=utf-8
SOAPAction: "#faultstring"
500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line 16
#################################
POST http://localhost/blah/DummyService HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/0.714
Content-Length: 394
Content-Type: text/xml; charset=utf-8
SOAPAction: "#NONSENSE"
500 Can't connect to localhost:80 (timeout) at soap.lite.fault.pl line 18