Loading ...
Sorry, an error occurred while loading the content.

6309Re: [soaplite] Re: How do I add custom trace callbacks?

Expand Messages
  • Lee Carmichael
    Mar 25, 2009
    • 0 Attachment
      Hello Petar,

      After seeing your example, I just realized that you are trying to debug a server. Sorry my last post won't be much help since it seems that transport level debugging is a client only option.

      It seems that most of the server code doesn't have any trace statements besides the empty create/destroy ones (you can see these as SOAP::Trace::trace( '()' ) ).

      You tell what is traceable by looking through the code for SOAP::Trace::<signal>. For example in SOAP::Lite under the package SOAP::Server you can see an entry like:


      It seems that you could get information from parameters or results for servers. Which doesn't strike me as terribly helpful.

      I did have an idea that i tested out. Since you said you were trying to debug request and responses, these will get passed to the deserializer and serializer. I was able to write a stub that logs the requests by sub classing the existing deserializer class into one that includes logging.

      Here is an example:


      use SOAP::Lite +trace => 'all';
      use SOAP::Transport::HTTP;
      use warnings;
      use strict;

      package DebugDS;

      use SOAP::Lite;
      use Data::Dumper qw(Dumper);
      our @ISA =  qw( SOAP::Deserializer ); ## can't use base due to error about deserializer not returning true...

      sub deserialize {
          my $self = shift;

          SOAP::Trace::trace( $_[0] );

          return $self->SUPER::deserialize( @_ );

      package main;

      my $daemon;
      my $end_port = 9905;
      my $started = 0;

      foreach (my $port = 9900; $port <= $end_port; $port++ ) {
          eval {
              $daemon = SOAP::Transport::HTTP::Daemon
                  -> new( LocalAddr => 'localhost', LocalPort => $port )
                  -> dispatch_to( '../../lib/', 'TestSoap' )
                  -> deserializer( DebugDS->new );

          if (!$@) {
              $started = 1;

      if (! $started ) { die "ERROR: Failed to start webserver: $@\n"; }

      print "Contact to SOAP server at ", $daemon->url, " ($$)\n";



      I'm sure you could do something similar to SOAP::Transport::HTTP::Daemon by using a sub class to do custom processing of the accept and dumping out the request/response content. Maybe I'll look at that tonight.


    • Show all 9 messages in this topic