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

3224RE: [soaplite] Re: Viewing incoming soap envelope and XML - from server side CGI

Expand Messages
  • Maurice McCabe
    Dec 8, 2003
      I have not done that but I would not be surprised if you could do the
      equivalent in the Serializer. Here is what my SOAP server loooks like ( I am
      using a LiteralSerializer generously contributed to the group, works with
      .NET, Axis clients, etc...):

      #!/usr/bin/perl

      use SOAP::Lite;

      SOAP::Transport::HTTP::CGI
      -> serializer(LiteralSerializer->new)
      -> deserializer(LiteralDeserializer->new)
      -> dispatch_to('/usr/local/SOAPmodules');
      -> handle ;

      BEGIN {

      package LiteralSerializer;
      @LiteralSerializer::ISA = 'SOAP::Serializer';
      sub xmlize {
      my $self = shift;
      my($name, $attrs, $values, $id) = @{+shift};
      $attrs ||= {};

      # keep only namespace attributes for all elements
      my $a = $attrs->{xmlns} ? {xmlns => $attrs->{xmlns}} : {};

      return $self->SUPER::xmlize([$name, $a, $values, $id]);
      }
      sub envelope {
      $_[2] = (UNIVERSAL::isa($_[2] => 'SOAP::Data') ? $_[2] :
      SOAP::Data->name($_[2])->attr({xmlns => $uri}))
      if $_[1] =~ /^(?:method|response)$/;
      shift->SUPER::envelope(@_);
      }

      package LiteralDeserializer;
      @LiteralDeserializer::ISA = 'SOAP::Deserializer';
      sub deserialize {
      my $self = shift;
      my $result = $self->SUPER::deserialize(@_);
      $result->{_message} = @_[0];
      return $result;
      }

      }


      Somewhere in the LiterSerializer is the outgoing message which can be
      isolated and logged. I think it is $a in xmlize() or $_[1] in envelope().
      Can someone confirm?

      Maurice

      -----Original Message-----
      From: Kevin M. Goess [mailto:kgoess@...]
      Sent: Monday, December 08, 2003 12:28 PM
      To: Maurice McCabe; soaplite@yahoogroups.com
      Subject: Re: [soaplite] Re: Viewing incoming soap envelope and XML -
      from server side CGI


      > If you do not want to modify the code here is another way:

      Nice! Is there a similar way you can get at the outgoing XML from the
      server
      to the client? I find it pretty helpful to log the incoming and outgoing
      XML
      on the server. (The patch I posted does that, along with the HTTP headers.)

      --
      Kevin M. Goess
      Software Engineer
      Ensenda, Inc.
    • Show all 6 messages in this topic