This section provides a tutorial example on how to use the SOAP::Lite tracing function to dump tracing information of the communication session for debugging.
In the sample programs shown in the previous section, you don't see any SOAP XML messages.
And you don't see how the server and the client send messages to each other. All of these
are hidden behind SOAP::Lite modules. If you want to know more about how SOAP::Lite modules
work, you can turn on the trace function on the SOAP::Lite module.
Here is the revised server program with trace on:
#- SoapTcpServerTrace.pl
#- Copyright (c) 2002 by Dr. Herong Yang, http://www.herongyang.com/
use SOAP::Lite +trace;
use SOAP::Transport::TCP;
my $daemon = SOAP::Transport::TCP::Server
->new(LocalAddr => 'localhost', LocalPort => 8001, Listen => 5);
$daemon->dispatch_to('Hello::hello');
print "SOAP TCP server listening...\n";
print " Host: ", $daemon->sockhost, "\n";
print " Port: ", $daemon->sockport, "\n";
$daemon->handle();
Here is the revised client program with trace on:
#- SoapTcpClientTrace.pl
#- Copyright (c) 2002 by Dr. Herong Yang, http://www.herongyang.com/
use SOAP::Lite +trace;
my $client = SOAP::Lite->new();
$client->uri('urn:Hello');
$client->proxy('tcp://localhost:8001');
my $som = $client->hello("Herong");
my $output = $som->result;
print $output . "\n";
Running the server first, and then the client, you will get on the client side: