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

Re: [ANNOUNCE] Apache::SOAP 0.47 (mod_soap)

Expand Messages
  • Larry Mulcahy
    Greetings, Re: http://groups.yahoo.com/group/modperl/message/33398 How would I go about altering the serializer of a SOAP::Lite server? In the client,
    Message 1 of 5 , Apr 24, 2001
    • 0 Attachment
      Greetings,

      Re:

      http://groups.yahoo.com/group/modperl/message/33398

      How would I go about altering the serializer of a SOAP::Lite server?

      In the client, everything is done in a method of
      SOAP::Lite, so I understand doing a

      my $soap = SOAP::Lite->serializer(My::Serializer->new)->.......

      and then replacing calls like

      SOAP::Lite->method1(args)->method2(args)

      with

      $soap->method1(args)->method2(args)

      but what do you do in a server (e.g. a CGI script) where SOAP::Lite
      is not referred to directly this way?

      --
      Larry Mulcahy lmulcahy@...
      PGP public key at:
      http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
    • Paul Kulchenko
      Hi, Larry! You could do it almost the same way as on client side. Example: my $daemon = SOAP::Transport::HTTP::Daemon - new ( LocalAddr = localhost ,
      Message 2 of 5 , Apr 24, 2001
      • 0 Attachment
        Hi, Larry!

        You could do it almost the same way as on client side. Example:

        my $daemon = SOAP::Transport::HTTP::Daemon
        -> new ( LocalAddr => 'localhost', LocalPort => 80 )
        -> deserializer(XMLRPC::Deserializer->new)
        -> serializer(XMLRPC::Serializer->new)
        -> dispatch_to('methodName')
        ;
        print "Contact to SOAP server at ", $daemon->url, "\n";
        $daemon->handle;

        ....skipped

        It's SOAP::Lite's enpoint with XML-RPC serializer and deserializer,
        hence will work as XML-RPC endpoint :))

        It's available in ALL transports, serializer() and deserializer()
        calls should be before handle() call, and obviously you may change
        only one of them if you want.

        Best wishes, Paul.

        --- Larry Mulcahy <lmulcahy@...> wrote:
        > http://groups.yahoo.com/group/modperl/message/33398
        >
        > How would I go about altering the serializer of a SOAP::Lite
        > server?
        >
        > In the client, everything is done in a method of
        > SOAP::Lite, so I understand doing a
        >
        > my $soap = SOAP::Lite->serializer(My::Serializer->new)->.......
        >
        > and then replacing calls like
        >
        > SOAP::Lite->method1(args)->method2(args)
        >
        > with
        >
        > $soap->method1(args)->method2(args)
        >
        > but what do you do in a server (e.g. a CGI script) where SOAP::Lite
        > is not referred to directly this way?
        >
        > --
        > Larry Mulcahy lmulcahy@...
        > PGP public key at:
        > http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Yahoo! Auctions - buy the things you want at great prices
        http://auctions.yahoo.com/
      • Larry Mulcahy
        Thanks, I tried a couple of examples replacing the serializer and deserializer with XMLRPC::Serializer and XMLRPC::Deserializer and was able to get that to
        Message 3 of 5 , Apr 25, 2001
        • 0 Attachment
          Thanks,

          I tried a couple of examples replacing the serializer and
          deserializer with XMLRPC::Serializer and XMLRPC::Deserializer
          and was able to get that to work OK.

          My interest in this is to get better performance. One of my
          test cases does a database query returning about 11,000 records.
          This takes about 36 seconds using straight SOAP::Lite as a CGI
          script. When I replaced the serializer of the server with
          XMLRPC::Serializer it took about 25 seconds.

          Now I'm trying to use some of the techniques shown in
          http://groups.yahoo.com/group/modperl/message/33398
          to make a custom serializer for an array.

          My server script now looks as follows. This doesn't seem to
          be working. I am snooping the packets and the XML generated
          for 'return(@result)' looks like usual with <s-gensymNN> tags for
          the array elements.

          What am I doing wrong?

          use SOAP::Transport::HTTP;

          [...]

          SOAP::Transport::HTTP::CGI
          -> serializer(My::Serializer::XML->new)
          -> dispatch_to('Pg')
          -> handle;

          package Pg;

          sub query
          {
          my($class, $sql) = @_;

          [...]

          my(@result) = ();

          [perform query $sql on DB, @result = list of strings]

          return(@result);
          }

          BEGIN {
          package My::Serializer::XML;

          @My::Serializer::XML::ISA = 'SOAP::Serializer';

          sub encode_array {
          my($self, $array, $name, $type, $attr) = @_;

          my $items = join '', '<Array>', map("<item>$_</item>", @$array),
          '</Array>';

          return [$name, {'_xml' => 1}, $items];
          }
          }


          Paul Kulchenko wrote:
          >
          > Hi, Larry!
          >
          > You could do it almost the same way as on client side. Example:
          >
          > my $daemon = SOAP::Transport::HTTP::Daemon
          > -> new ( LocalAddr => 'localhost', LocalPort => 80 )
          > -> deserializer(XMLRPC::Deserializer->new)
          > -> serializer(XMLRPC::Serializer->new)
          > -> dispatch_to('methodName')
          > ;
          > print "Contact to SOAP server at ", $daemon->url, "\n";
          > $daemon->handle;
          >
          > ....skipped
          >
          > It's SOAP::Lite's enpoint with XML-RPC serializer and deserializer,
          > hence will work as XML-RPC endpoint :))
          >
          > It's available in ALL transports, serializer() and deserializer()
          > calls should be before handle() call, and obviously you may change
          > only one of them if you want.
          >
          > Best wishes, Paul.

          --
          Larry Mulcahy lmulcahy@...
          PGP public key at:
          http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
        • Paul Kulchenko
          Hi, Larry! I didn t run your example, but it seems like you re trying to return result as a LIST of elements, instead of an array (and encode_array is not
          Message 4 of 5 , Apr 25, 2001
          • 0 Attachment
            Hi, Larry!

            I didn't run your example, but it seems like you're trying to return
            result as a LIST of elements, instead of an array (and encode_array
            is not called):

            return [@result];

            instead of:

            return(@result);

            should make what you want.

            Then on client:

            $arrayref = $soap->.....->result;

            gives you your array back. Keep me informed on your progress.

            Best wishes, Paul.

            --- Larry Mulcahy <lmulcahy@...> wrote:
            > Thanks,
            >
            > I tried a couple of examples replacing the serializer and
            > deserializer with XMLRPC::Serializer and XMLRPC::Deserializer
            > and was able to get that to work OK.
            >
            > My interest in this is to get better performance. One of my
            > test cases does a database query returning about 11,000 records.
            > This takes about 36 seconds using straight SOAP::Lite as a CGI
            > script. When I replaced the serializer of the server with
            > XMLRPC::Serializer it took about 25 seconds.
            >
            > Now I'm trying to use some of the techniques shown in
            > http://groups.yahoo.com/group/modperl/message/33398
            > to make a custom serializer for an array.
            >
            > My server script now looks as follows. This doesn't seem to
            > be working. I am snooping the packets and the XML generated
            > for 'return(@result)' looks like usual with <s-gensymNN> tags for
            > the array elements.
            >
            > What am I doing wrong?
            >
            > use SOAP::Transport::HTTP;
            >
            > [...]
            >
            > SOAP::Transport::HTTP::CGI
            > -> serializer(My::Serializer::XML->new)
            > -> dispatch_to('Pg')
            > -> handle;
            >
            > package Pg;
            >
            > sub query
            > {
            > my($class, $sql) = @_;
            >
            > [...]
            >
            > my(@result) = ();
            >
            > [perform query $sql on DB, @result = list of strings]
            >
            > return(@result);
            > }
            >
            > BEGIN {
            > package My::Serializer::XML;
            >
            > @My::Serializer::XML::ISA = 'SOAP::Serializer';
            >
            > sub encode_array {
            > my($self, $array, $name, $type, $attr) = @_;
            >
            > my $items = join '', '<Array>', map("<item>$_</item>", @$array),
            > '</Array>';
            >
            > return [$name, {'_xml' => 1}, $items];
            > }
            > }
            >
            >
            > Paul Kulchenko wrote:
            > >
            > > Hi, Larry!
            > >
            > > You could do it almost the same way as on client side. Example:
            > >
            > > my $daemon = SOAP::Transport::HTTP::Daemon
            > > -> new ( LocalAddr => 'localhost', LocalPort => 80 )
            > > -> deserializer(XMLRPC::Deserializer->new)
            > > -> serializer(XMLRPC::Serializer->new)
            > > -> dispatch_to('methodName')
            > > ;
            > > print "Contact to SOAP server at ", $daemon->url, "\n";
            > > $daemon->handle;
            > >
            > > ....skipped
            > >
            > > It's SOAP::Lite's enpoint with XML-RPC serializer and
            > deserializer,
            > > hence will work as XML-RPC endpoint :))
            > >
            > > It's available in ALL transports, serializer() and deserializer()
            > > calls should be before handle() call, and obviously you may
            > change
            > > only one of them if you want.
            > >
            > > Best wishes, Paul.
            >
            > --
            > Larry Mulcahy lmulcahy@...
            > PGP public key at:
            > http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            >
            >


            __________________________________________________
            Do You Yahoo!?
            Yahoo! Auctions - buy the things you want at great prices
            http://auctions.yahoo.com/
          • Larry Mulcahy
            Got it working now for approximately a 4X performance improvement, thanks! ... -- Larry Mulcahy lmulcahy@qip.qwest.net PGP public key at:
            Message 5 of 5 , Apr 25, 2001
            • 0 Attachment
              Got it working now for approximately a 4X performance improvement,
              thanks!

              Paul Kulchenko wrote:

              > Hi, Larry!

              > I didn't run your example, but it seems like you're trying to return
              > result as a LIST of elements, instead of an array (and encode_array
              > is not called):
              > return [@result];
              > instead of:
              > return(@result);
              > should make what you want.

              > Then on client:
              > $arrayref = $soap->.....->result;
              > gives you your array back. Keep me informed on your progress.

              > Best wishes, Paul.
              --
              Larry Mulcahy lmulcahy@...
              PGP public key at:
              http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x2C4C5A03
            Your message has been successfully submitted and would be delivered to recipients shortly.