Herong's Tutorial Notes on Perl - Part B
Dr. Herong Yang, Version 4.11

SOAP::Lite Modules

Part:   1  2  3  

(Continued from previous part...)

SOAP::Lite Tracing

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
   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
   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:

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:

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.

Part:   1  2  3  

Dr. Herong Yang, updated in 2006
Herong's Tutorial Notes on Perl - Part B - SOAP::Lite Modules