SOAP::Lite Tracing Functions

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-2018 HerongYang.com, All Rights Reserved.

   use lib './'; # to be able to load Hello.pm in the current directory

   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 HerongYang.com, All Rights Reserved.

   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:

C:\herong>perl SoapTcpClientTrace.pl

SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Transport::TCP::Client::new: ()
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: hello Herong
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Transport::TCP::Client::send_receive: <?xml version="1.0" encodi
ng="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.
org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envel
ope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd=
"http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><namesp1:hello xmlns
:namesp1="urn:Hello"><c-gensym3 xsi:type="xsd:string">Herong</c-gensym
3></namesp1:hello></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP::Transport::TCP::Client::send_receive: <?xml version="1.0" encodi
ng="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.
org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org
/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envel
ope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd=
"http://www.w3.org/1999/XMLSchema"><SOAP-ENV:Body><namesp1:helloRespon
se xmlns:namesp1="urn:Hello"><s-gensym3 xsi:type="xsd:string">Hello He
rong</s-gensym3></namesp1:helloResponse></SOAP-ENV:Body></SOAP-ENV:Env
elope>
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()

Hello Herong

SOAP::Lite::DESTROY: ()
SOAP::Serializer::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Data::DESTROY: ()
SOAP::Transport::DESTROY: ()
SOAP::Transport::TCP::Client::DESTROY: ()
SOAP::SOM::DESTROY: ()
SOAP::Deserializer::DESTROY: ()
SOAP::Parser::DESTROY: ()

On the server side, you will get:

C:\herong>perl SoapTcpServerTrace.pl

SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Server::new: ()
SOAP::Transport::TCP::Server::new: ()

SOAP TCP server listening...
   Host: 127.0.0.1
   Port: 8001
   
SOAP::Server::handle: ()
SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
SOAP::Data::new: ()
SOAP::Data::DESTROY: ()
(eval): Herong
SOAP::Server::handle: Hello Herong
SOAP::Serializer::envelope: ()
SOAP::Serializer::envelope: helloResponse Hello Herong
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::Data::new: ()
SOAP::SOM::DESTROY: ()

Now you see the SOAP XML request, and the response generated by SOAP::Lite modules.

Last update: 2018.

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

 SOAP Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

 SOAP Encoding

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP MEP (Message Exchange Patterns)

 SOAP HTTP Binding

 SOAP PHP Implementations

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 PHP SOAP Web Service Example - getTemp

 SOAP Perl Implementations

Perl SOAP::Lite - SOAP Server-Client Communication Module

 SOAP Communication Model

 What Is SOAP::Lite

 SOAP::Transport::TCP::Server - SOAP Server with TCP Protocol

 SoapTcpClient.pl - SOAP Client Example with TCP Protocol

SOAP::Lite Tracing Functions

 SOAP::Transport::HTTP - SOAP Server with HTTP Protocol

 Perl Socket Test Program for HTTP and SOAP

 Perl SOAP::Lite for NumberToWords SOAP 1.1 Web Service

 Perl SOAP::Lite for SOAP 1.2 Web Services

 Perl SOAP::Lite for WSDL

 SOAP Java Implementations

 Java Socket and HttpURLConnection for SOAP

 SAAJ - SOAP with Attachments API for Java

 SoapUI - SOAP Web Service Testing Tool

 WS-Security - SOAP Message Security Extension

 WS-Security X.509 Certificate Token

 Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service

 Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services

 Perl SOAP::Lite 0.710 for WSDL

 Web Services and SOAP Terminology

 Outdated Tutorials

 References

 Full Version in PDF/EPUB