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

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

Expand Messages
  • Lee Carmichael
    Mar 24, 2009
      Hello Petar,

      You can you be more specific by adding transport layer debugging:
      use SOAP::Lite +trace => [
      transport => sub { print "calls to transport for request and response\n";
      It is important to know that this must be defined before any other use SOAP::Lite statement (I'm not sure why but i had troubles with it other places).

      You can create smarter logging subs by doing the following (note: untested and brief):

      use SOAP::Lite +trace => [
      transport => &transport_logger

      sub transport_logger {
      my $in = shift; # SOAP::Lite pushes in the object its call

      ## only log request and responses
      return unless ref $in =~ /HTTP::(Request|Request)/'

      open my $fh, '>>', 'transport.log' or return;
      printf $fh "%s: %s\n", ref $in, ( $in->content ? $in->content : "N/A" );
      close $fh;


      You can see more details about how SOAP::Trace works at: http://search.cpan.org/~mkutter/SOAP-Lite-0.710.08/lib/SOAP/Trace.pod
      I have a little write up on this at my blog: http://blog.leecarmichael.com/2009/03/adding-http-requestresponse-logging-to.html



      > > Hi, I have a SOAP::Lite based server and an need to enable soma
      > > advanced debugging. In particular, I need to print out the full
      > > requests and responses for each call. But I cannot get my callbacks to
      > > get invoked. In my soap server script (currently running in a
      > > development environment with SOAP::Transport: :HTTP::Daemon) I have
      > > tried:
      > >
      > > use SOAP::Lite +trace => [debug => sub {print "test!\n";}] ;
      > >
      > > but nothing happens. I have tried printing to a filehandle as well, but still
      > no result.
      > I simply use

    • Show all 9 messages in this topic