$ perl soap-lite-server.pl Contact to SOAP server at http://127.0.0.1:10013/ OrderInquiry called $VAR1 = [ 'physi' ]; $VAR1 = { 'OrderInquiry' => { 'vorname' => 'physi' } }; $VAR1 = bless( { '_faultstring' => 'Died in server method', '_faultactor' => 'http://www.soaplite.com/custom', '_faultcode' => 'Server.Custom', '_faultdetail' => bless( { 'code' => 1 }, 'BadError' ) }, 'SOAP::Fault' ); Terminating on signal SIGINT(2) $ #### POST http://localhost:10013/ HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/1.11 Content-Length: 456 Content-Type: text/xml; charset=utf-8 SOAPAction: "/Demo#OrderInquiry" physi HTTP/1.1 200 OK Date: Thu, 03 Jul 2014 07:57:13 GMT Server: libwww-perl-daemon/6.01 Content-Length: 497 Content-Type: text/xml; charset=utf-8 Client-Date: Thu, 03 Jul 2014 07:57:13 GMT Client-Peer: 127.0.0.1:10013 Client-Response-Num: 1 SOAPServer: SOAP::Lite/Perl/1.11 OrderInquiry order Created POST http://localhost:10013/ HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/1.11 Content-Length: 460 Content-Type: text/xml; charset=utf-8 SOAPAction: "/Demo#die_with_fault" physi HTTP/1.1 500 Internal Server Error Date: Thu, 03 Jul 2014 07:57:13 GMT Server: libwww-perl-daemon/6.01 Content-Length: 687 Content-Type: text/xml; charset=utf-8 Client-Date: Thu, 03 Jul 2014 07:57:13 GMT Client-Peer: 127.0.0.1:10013 Client-Response-Num: 1 SOAPServer: SOAP::Lite/Perl/1.11 soap:Server.Custom Died in server method http://www.soaplite.com/custom 1 faultcode = soap:Server.Custom faultstring = Died in server method faultdetail = HASH(0x17beb14) faultactor = http://www.soaplite.com/custom #### #!/usr/bin/perl -- ## ## 2014-07-03-00:50:25 ## ## ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); sub Main { use SOAP::Transport::HTTP; my $daemon = SOAP::Transport::HTTP::Daemon->new( LocalAddr => 'localhost', LocalPort => 10013, Reuse => 1 )->dispatch_to( 'Demo' ); print "Contact to SOAP server at ", $daemon->url, "\n"; $daemon->handle; } ## end sub Main BEGIN { package Demo; use Data::Dumper; use vars qw(@ISA); @ISA = qw(SOAP::Server::Parameters); sub OrderInquiry { print "OrderInquiry called\n"; my $self = shift; my $envelope = pop; print Dumper( \@_ ); print Dumper( $envelope->valueof( '/Envelope/Body' ) ); return "OrderInquiry order Created"; } ## end sub OrderInquiry sub die_with_fault { my $fault = SOAP::Fault->faultcode( 'Server.Custom' ) # will be qualified ->faultstring( 'Died in server method' ) ->faultdetail( bless { code => 1 } => 'BadError' ) ->faultactor( 'http://www.soaplite.com/custom' ); print Dumper( $fault ); die $fault; } ## end sub die_with_fault 1; } ## end BEGIN __END__ #### #!/usr/bin/perl -- ## ## 2014-07-03-00:50:25 ## ## ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if " -otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use SOAP::Lite; Main( @ARGV ); exit( 0 ); sub Main { my $soap = SOAP::Lite->uri( '/Demo' )->proxy( 'http://localhost:10013/' ); $soap->transport->add_handler( "request_send", \&pp_dump ); $soap->transport->add_handler( "response_done", \&pp_dump ); $soap->OrderInquiry( SOAP::Data->name( vorname => 'physi' ) ); my $som = $soap->die_with_fault( SOAP::Data->name( vorname => 'physi' ) ); for my $method ( qw/ faultcode faultstring faultdetail faultactor / ) { printf "%-20s = %s\n", $method, $som->$method; } } ## end sub Main sub pp_twig { use XML::Twig; open my( $fh ), '>', \my $str; no warnings 'newline'; #~ XML::Twig->new(qw! pretty_print record !)->xparse(@_)->print( $fh ); XML::Twig->new( qw! pretty_print record ! )->parse( @_ )->print( $fh ); $str =~ s/ xmlns:/\n xmlns:/g; return $str; } ## end sub pp_twig sub pp_dump { my $content = $_[0]->content( '' ); $_[0]->content( pp_twig( $content ) ); print $_[0]->as_string, "\n"; return; } ## end sub pp_dump