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

performance in SOAP::Utils::encode_data

Expand Messages
  • Jeremy Lublin
    Here s an interesting solution to a performance problem I m having when sending an xml string through SOAP. My example xml string is about 500k When I use the
    Message 1 of 1 , Aug 11, 2004
    • 0 Attachment
      Here's an interesting solution to a performance problem I'm having when
      sending an xml string through SOAP.

      My example xml string is about 500k When I use the default Serializer, the
      full SOAP call takes about 370 seconds. If I use the following
      My::Seriailizer, my SOAP call takes about 35 seconds. Roughly 30 seconds of
      each call is for preparing the XML. The remaining time is the Serializer.

      My question is... Have I 100% duplicated the default encode_data routine? Or
      will mine behave differently than the stock subroutine.

      -Jeremy

      BEGIN {
      package MySerializer;
      @MySerializer::ISA = 'SOAP::Serializer';
      # methods of MySerializer
      # ....

      sub as_xmlstring {

      my $self = shift;
      my($value, $name, $type, $attr) = @_;
      die "String value expected instead of @{[ref
      $value]} reference\n" if ref $value;
      return [$name, {'xsi:type' => 'xsd:string', %$attr},
      encode_data($value)];
      }

      sub encode_data {

      my $e = $_[0];
      #my %encode_data = ('&' => '&', '<' => '<', "\xd" =>
      ' ');
      #$e =~ s/([&<\015])/$encode_data{$1}/g;
      #$e =~ s/\]\]>/\]\]>/g;

      $e =~ s/&/&/g;
      $e =~ s/</</g;
      $e =~ s/\015/ /g;
      $e =~ s/\]\]>/\]\]>/g;
      return($e);

      }
      }
    Your message has been successfully submitted and would be delivered to recipients shortly.