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

RE: [soaplite] Subclassing SOAP::Transport::HTTP::Daemon

Expand Messages
  • Michael Percy
    Paul, I tried to subclass it and even used the code from forkingdaemon.pm in my own module but it would not work for me. Have you tried putting the definition
    Message 1 of 6 , Feb 13, 2001
    • 0 Attachment
      Paul,
      I tried to subclass it and even used the code from forkingdaemon.pm in my
      own module but it would not work for me. Have you tried putting the
      definition of a subclass outside of SOAP/Transport/HTTP.pm and tried to
      instantiate it? If you could get that to work I would be very much
      appreciative! (else just tell me I'm being stupid and to try again ;) I
      tried for several hours yesterday to no avail. (note: it did work if I put
      my new class in your module file).

      Thanks!
      Michael

      > -----Original Message-----
      > From: Paul Kulchenko [mailto:paulclinger@...]
      > Sent: Tuesday, February 13, 2001 2:05 PM
      > To: soaplite@yahoogroups.com
      > Subject: Re: [soaplite] Subclassing SOAP::Transport::HTTP::Daemon
      >
      >
      > Hi, Michael!
      >
      > Why not? There is no restrictions on subclassing or inheritance. Take
      > a look into examples/SOAP/Transport/HTTP/ForkingDaemon which is
      > inherited from SOAP::Transport::HTTP::Daemon.
      >
      > As for SIG{INT} I planned to add SIG{PIPE} and SIG{INT} handlers, but
      > don't do it yet, so if you could provide a code or example I'll
      > incorporate it into Transport::HTTP::Daemon implementation. Thank
      > you.
      >
      > Best wishes, Paul.
      >
      > --- Michael Percy <mpercy@...> wrote:
      > > Hello,
      > > I am trying to catch SIG{INT} and gracefully close the connection
      > > in the
      > > daemon implementation of the SOAP::Lite server. However, I cannot
      > > seem to
      > > subclass SOAP::Transport::HTTP::Daemon!
      > >
      > > I believe this problem stems from the fact that all of the
      > > SOAP::Transport::HTTP::* classes reside in one file:
      > > SOAP/Transport/HTTP.pm.
      > > I am perfectly able to "use SOAP::Transport::HTTP" and then
      > > instantiate a
      > > ::Daemon class or ::Server class but I cannot for the life of me
      > > inherit
      > > from one!
      > >
      > > When I put SOAP::Transport::HTTP::Daemon in my @ISA array, even if
      > > I am
      > > "use"ing SOAP::Transport::HTTP, when I try to create an object of
      > > my
      > > subclass I get the error: 'Can't locate object method "new" via
      > > package
      > > "MyDaemon"' (my subclass). It is really strange.
      > >
      > > Does the @ISA "classloader" mechanism work differently that the
      > > @INC
      > > classloader mechanism? What I mean is, am I doing something
      > > wrong/being
      > > stupid, is Perl having problems, or was what the author did an
      > > unsupported
      > > use of packages/classes?
      > >
      > > Is there a workaround? ( !!! :-)
      > >
      > > Hope I have been clear enough!
      > >
      > >
      > > Regards,
      > >
      > > Michael Percy
      > > Software Engineer, Portera Systems
      > >
      > > ------------------------ Yahoo! Groups Sponsor
      > >
      > > To unsubscribe from this group, send an email to:
      > > soaplite-unsubscribe@yahoogroups.com
      > >
      > >
      > >
      >
      >
      > __________________________________________________
      > Do You Yahoo!?
      > Get personalized email addresses from Yahoo! Mail - only $35
      > a year! http://personal.mail.yahoo.com/
      >
      > ------------------------ Yahoo! Groups Sponsor
      > ---------------------~-~>
      > eGroups is now Yahoo! Groups
      > Click here for more details
      > http://click.egroups.com/1/11231/1/_/_/_/982101923/
      > --------------------------------------------------------------
      > -------_->
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
    • Paul Kulchenko
      Hi, Michael! Ok, lets take saop.daemon and modify it to call My::Daemon. Following code will work exactly as usual SOAP::Transport::HTTP::Daemon: use
      Message 2 of 6 , Feb 13, 2001
      • 0 Attachment
        Hi, Michael!

        Ok, lets take saop.daemon and modify it to call My::Daemon. Following
        code will work exactly as usual SOAP::Transport::HTTP::Daemon:

        use SOAP::Transport::HTTP;

        my $daemon = My::Daemon
        -> new (LocalAddr => 'localhost', LocalPort => 80)
        -> objects_by_reference(qw(My::PersistentIterator
        My::SessionIterator My::Chat))
        -> dispatch_to('/Your/Path/To/Deployed/Modules', 'Module::Name',
        'Module::method')
        ;
        print "Contact to SOAP server at ", $daemon->url, "\n";
        $daemon->handle;

        BEGIN {
        package My::Daemon;
        use SOAP::Transport::HTTP;
        @ISA = 'SOAP::Transport::HTTP::Daemon';
        }

        You may put inside your methods or whatever you want. Hope it helps.

        Best wishes, Paul.

        --- Michael Percy <mpercy@...> wrote:
        > Paul,
        > I tried to subclass it and even used the code from forkingdaemon.pm
        > in my
        > own module but it would not work for me. Have you tried putting the
        > definition of a subclass outside of SOAP/Transport/HTTP.pm and
        > tried to
        > instantiate it? If you could get that to work I would be very much
        > appreciative! (else just tell me I'm being stupid and to try again
        > ;) I
        > tried for several hours yesterday to no avail. (note: it did work
        > if I put
        > my new class in your module file).
        >
        > Thanks!
        > Michael
        >
        > > -----Original Message-----
        > > From: Paul Kulchenko [mailto:paulclinger@...]
        > > Sent: Tuesday, February 13, 2001 2:05 PM
        > > To: soaplite@yahoogroups.com
        > > Subject: Re: [soaplite] Subclassing SOAP::Transport::HTTP::Daemon
        > >
        > >
        > > Hi, Michael!
        > >
        > > Why not? There is no restrictions on subclassing or inheritance.
        > Take
        > > a look into examples/SOAP/Transport/HTTP/ForkingDaemon which is
        > > inherited from SOAP::Transport::HTTP::Daemon.
        > >
        > > As for SIG{INT} I planned to add SIG{PIPE} and SIG{INT} handlers,
        > but
        > > don't do it yet, so if you could provide a code or example I'll
        > > incorporate it into Transport::HTTP::Daemon implementation. Thank
        > > you.
        > >
        > > Best wishes, Paul.
        > >
        > > --- Michael Percy <mpercy@...> wrote:
        > > > Hello,
        > > > I am trying to catch SIG{INT} and gracefully close the
        > connection
        > > > in the
        > > > daemon implementation of the SOAP::Lite server. However, I
        > cannot
        > > > seem to
        > > > subclass SOAP::Transport::HTTP::Daemon!
        > > >
        > > > I believe this problem stems from the fact that all of the
        > > > SOAP::Transport::HTTP::* classes reside in one file:
        > > > SOAP/Transport/HTTP.pm.
        > > > I am perfectly able to "use SOAP::Transport::HTTP" and then
        > > > instantiate a
        > > > ::Daemon class or ::Server class but I cannot for the life of
        > me
        > > > inherit
        > > > from one!
        > > >
        > > > When I put SOAP::Transport::HTTP::Daemon in my @ISA array, even
        > if
        > > > I am
        > > > "use"ing SOAP::Transport::HTTP, when I try to create an object
        > of
        > > > my
        > > > subclass I get the error: 'Can't locate object method "new" via
        > > > package
        > > > "MyDaemon"' (my subclass). It is really strange.
        > > >
        > > > Does the @ISA "classloader" mechanism work differently that the
        > > > @INC
        > > > classloader mechanism? What I mean is, am I doing something
        > > > wrong/being
        > > > stupid, is Perl having problems, or was what the author did an
        > > > unsupported
        > > > use of packages/classes?
        > > >
        > > > Is there a workaround? ( !!! :-)
        > > >
        > > > Hope I have been clear enough!
        > > >
        > > >
        > > > Regards,
        > > >
        > > > Michael Percy
        > > > Software Engineer, Portera Systems
        > > >
        > > > ------------------------ Yahoo! Groups Sponsor
        > > >
        > > > To unsubscribe from this group, send an email to:
        > > > soaplite-unsubscribe@yahoogroups.com
        > > >
        > > >
        > > >
        > >
        > >
        > > __________________________________________________
        > > Do You Yahoo!?
        > > Get personalized email addresses from Yahoo! Mail - only $35
        > > a year! http://personal.mail.yahoo.com/
        > >
        > > ------------------------ Yahoo! Groups Sponsor
        > > ---------------------~-~>
        > > eGroups is now Yahoo! Groups
        > > Click here for more details
        > > http://click.egroups.com/1/11231/1/_/_/_/982101923/
        > > --------------------------------------------------------------
        > > -------_->
        > >
        > > To unsubscribe from this group, send an email to:
        > > soaplite-unsubscribe@yahoogroups.com
        > >
        > >
        > >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Get personalized email addresses from Yahoo! Mail - only $35
        a year! http://personal.mail.yahoo.com/
      • Michael Percy
        Paul, That BEGIN block certainly did it! I don t know if that was just an experience thing but you have really made my day. Thank you very much, sir ...
        Message 3 of 6 , Feb 13, 2001
        • 0 Attachment
          Paul,
          That BEGIN block certainly did it! I don't know if that was just an
          experience thing but you have really made my day. Thank you very much, sir
          :)

          Regards,
          Michael Percy

          > -----Original Message-----
          > From: Paul Kulchenko [mailto:paulclinger@...]
          > Sent: Tuesday, February 13, 2001 6:07 PM
          > To: soaplite@yahoogroups.com
          > Subject: RE: [soaplite] Subclassing SOAP::Transport::HTTP::Daemon
          >
          >
          > Hi, Michael!
          >
          > Ok, lets take saop.daemon and modify it to call My::Daemon. Following
          > code will work exactly as usual SOAP::Transport::HTTP::Daemon:
          >
          > use SOAP::Transport::HTTP;
          >
          > my $daemon = My::Daemon
          > -> new (LocalAddr => 'localhost', LocalPort => 80)
          > -> objects_by_reference(qw(My::PersistentIterator
          > My::SessionIterator My::Chat))
          > -> dispatch_to('/Your/Path/To/Deployed/Modules', 'Module::Name',
          > 'Module::method')
          > ;
          > print "Contact to SOAP server at ", $daemon->url, "\n";
          > $daemon->handle;
          >
          > BEGIN {
          > package My::Daemon;
          > use SOAP::Transport::HTTP;
          > @ISA = 'SOAP::Transport::HTTP::Daemon';
          > }
          >
          > You may put inside your methods or whatever you want. Hope it helps.
          >
          > Best wishes, Paul.
          >
          > --- Michael Percy <mpercy@...> wrote:
          > > Paul,
          > > I tried to subclass it and even used the code from forkingdaemon.pm
          > > in my
          > > own module but it would not work for me. Have you tried putting the
          > > definition of a subclass outside of SOAP/Transport/HTTP.pm and
          > > tried to
          > > instantiate it? If you could get that to work I would be very much
          > > appreciative! (else just tell me I'm being stupid and to try again
          > > ;) I
          > > tried for several hours yesterday to no avail. (note: it did work
          > > if I put
          > > my new class in your module file).
          > >
          > > Thanks!
          > > Michael
          > >
          > > > -----Original Message-----
          > > > From: Paul Kulchenko [mailto:paulclinger@...]
          > > > Sent: Tuesday, February 13, 2001 2:05 PM
          > > > To: soaplite@yahoogroups.com
          > > > Subject: Re: [soaplite] Subclassing SOAP::Transport::HTTP::Daemon
          > > >
          > > >
          > > > Hi, Michael!
          > > >
          > > > Why not? There is no restrictions on subclassing or inheritance.
          > > Take
          > > > a look into examples/SOAP/Transport/HTTP/ForkingDaemon which is
          > > > inherited from SOAP::Transport::HTTP::Daemon.
          > > >
          > > > As for SIG{INT} I planned to add SIG{PIPE} and SIG{INT} handlers,
          > > but
          > > > don't do it yet, so if you could provide a code or example I'll
          > > > incorporate it into Transport::HTTP::Daemon implementation. Thank
          > > > you.
          > > >
          > > > Best wishes, Paul.
          > > >
          > > > --- Michael Percy <mpercy@...> wrote:
          > > > > Hello,
          > > > > I am trying to catch SIG{INT} and gracefully close the
          > > connection
          > > > > in the
          > > > > daemon implementation of the SOAP::Lite server. However, I
          > > cannot
          > > > > seem to
          > > > > subclass SOAP::Transport::HTTP::Daemon!
          > > > >
          > > > > I believe this problem stems from the fact that all of the
          > > > > SOAP::Transport::HTTP::* classes reside in one file:
          > > > > SOAP/Transport/HTTP.pm.
          > > > > I am perfectly able to "use SOAP::Transport::HTTP" and then
          > > > > instantiate a
          > > > > ::Daemon class or ::Server class but I cannot for the life of
          > > me
          > > > > inherit
          > > > > from one!
          > > > >
          > > > > When I put SOAP::Transport::HTTP::Daemon in my @ISA array, even
          > > if
          > > > > I am
          > > > > "use"ing SOAP::Transport::HTTP, when I try to create an object
          > > of
          > > > > my
          > > > > subclass I get the error: 'Can't locate object method "new" via
          > > > > package
          > > > > "MyDaemon"' (my subclass). It is really strange.
          > > > >
          > > > > Does the @ISA "classloader" mechanism work differently that the
          > > > > @INC
          > > > > classloader mechanism? What I mean is, am I doing something
          > > > > wrong/being
          > > > > stupid, is Perl having problems, or was what the author did an
          > > > > unsupported
          > > > > use of packages/classes?
          > > > >
          > > > > Is there a workaround? ( !!! :-)
          > > > >
          > > > > Hope I have been clear enough!
          > > > >
          > > > >
          > > > > Regards,
          > > > >
          > > > > Michael Percy
          > > > > Software Engineer, Portera Systems
          > > > >
          > > > > ------------------------ Yahoo! Groups Sponsor
          > > > >
          > > > > To unsubscribe from this group, send an email to:
          > > > > soaplite-unsubscribe@yahoogroups.com
          > > > >
          > > > >
          > > > >
          > > >
          > > >
          > > > __________________________________________________
          > > > Do You Yahoo!?
          > > > Get personalized email addresses from Yahoo! Mail - only $35
          > > > a year! http://personal.mail.yahoo.com/
          > > >
          > > > ------------------------ Yahoo! Groups Sponsor
          > > > ---------------------~-~>
          > > > eGroups is now Yahoo! Groups
          > > > Click here for more details
          > > > http://click.egroups.com/1/11231/1/_/_/_/982101923/
          > > > --------------------------------------------------------------
          > > > -------_->
          > > >
          > > > To unsubscribe from this group, send an email to:
          > > > soaplite-unsubscribe@yahoogroups.com
          > > >
          > > >
          > > >
          > >
          > > ------------------------ Yahoo! Groups Sponsor
          > >
          > > To unsubscribe from this group, send an email to:
          > > soaplite-unsubscribe@yahoogroups.com
          > >
          > >
          > >
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Get personalized email addresses from Yahoo! Mail - only $35
          > a year! http://personal.mail.yahoo.com/
          >
          > ------------------------ Yahoo! Groups Sponsor
          > ---------------------~-~>
          > eGroups is now Yahoo! Groups
          > Click here for more details
          > http://click.egroups.com/1/11231/1/_/_/_/982116422/
          > --------------------------------------------------------------
          > -------_->
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
        • Michael Percy
          Paul, I got rid of my SIG{INT} handler because it was messy :-), but I don t think it is needed. The IO::Socket::INET class specifies a parameter called
          Message 4 of 6 , Feb 14, 2001
          • 0 Attachment
            Paul,
            I got rid of my SIG{INT} handler because it was messy :-), but I don't think
            it is needed. The IO::Socket::INET class specifies a parameter called
            "Reuse", which allows for the reuse of a still-open (?) socket. I don't
            totally understand it however it seems like the best way to do thinks if you
            want your port to always be available after a Ctrl-C.

            Also, I have added a SIG{PIPE} handler which seems to work great where it is
            in the code. I hope you find this useful. Code follows:

            --
            #!/usr/local/bin/perl -w
            #########################################################################
            package main;
            use strict;

            my $PORT = 12039;
            my $daemon = My::Daemon
            -> new ( LocalPort => $PORT,
            Reuse => 1) #
            <-------------
            -> dispatch_to('TestClass');

            print "Access me at: ", $daemon->url(), "\n";
            $daemon->handle();

            # ====================================================

            BEGIN {
            package My::Daemon;
            use strict;

            use SOAP::Transport::HTTP;
            use vars qw(@ISA);
            @ISA = ('SOAP::Transport::HTTP::Daemon');

            sub handle {
            my $self = shift->new;
            CONN: while (my $c = $self->accept) {
            local $SIG{PIPE} = sub { warn "SIGPIPE: $!";
            $c->close; return 0; }; # <-----------
            while (my $r = $c->get_request) {
            $self->request($r);

            $self->SOAP::Transport::HTTP::Server::handle;
            $c->send_response($self->response);
            }
            $c->close;
            undef $c;
            }
            }
            }
            --

            Regards,
            Michael Percy

            > -----Original Message-----
            > From: Paul Kulchenko [mailto:paulclinger@...]
            > Sent: Tuesday, February 13, 2001 2:05 PM
            > To: soaplite@yahoogroups.com
            > Subject: Re: [soaplite] Subclassing SOAP::Transport::HTTP::Daemon
            >
            >
            > Hi, Michael!
            >
            > Why not? There is no restrictions on subclassing or inheritance. Take
            > a look into examples/SOAP/Transport/HTTP/ForkingDaemon which is
            > inherited from SOAP::Transport::HTTP::Daemon.
            >
            > As for SIG{INT} I planned to add SIG{PIPE} and SIG{INT} handlers, but
            > don't do it yet, so if you could provide a code or example I'll
            > incorporate it into Transport::HTTP::Daemon implementation. Thank
            > you.
            >
            > Best wishes, Paul.
            >
            > --- Michael Percy <mpercy@...> wrote:
            > > Hello,
            > > I am trying to catch SIG{INT} and gracefully close the connection
            > > in the
            > > daemon implementation of the SOAP::Lite server. However, I cannot
            > > seem to
            > > subclass SOAP::Transport::HTTP::Daemon!
            > >
            > > I believe this problem stems from the fact that all of the
            > > SOAP::Transport::HTTP::* classes reside in one file:
            > > SOAP/Transport/HTTP.pm.
            > > I am perfectly able to "use SOAP::Transport::HTTP" and then
            > > instantiate a
            > > ::Daemon class or ::Server class but I cannot for the life of me
            > > inherit
            > > from one!
            > >
            > > When I put SOAP::Transport::HTTP::Daemon in my @ISA array, even if
            > > I am
            > > "use"ing SOAP::Transport::HTTP, when I try to create an object of
            > > my
            > > subclass I get the error: 'Can't locate object method "new" via
            > > package
            > > "MyDaemon"' (my subclass). It is really strange.
            > >
            > > Does the @ISA "classloader" mechanism work differently that the
            > > @INC
            > > classloader mechanism? What I mean is, am I doing something
            > > wrong/being
            > > stupid, is Perl having problems, or was what the author did an
            > > unsupported
            > > use of packages/classes?
            > >
            > > Is there a workaround? ( !!! :-)
            > >
            > > Hope I have been clear enough!
            > >
            > >
            > > Regards,
            > >
            > > Michael Percy
            > > Software Engineer, Portera Systems
            > >
            > > ------------------------ Yahoo! Groups Sponsor
            > >
            > > To unsubscribe from this group, send an email to:
            > > soaplite-unsubscribe@yahoogroups.com
            > >
            > >
            > >
            >
            >
            > __________________________________________________
            > Do You Yahoo!?
            > Get personalized email addresses from Yahoo! Mail - only $35
            > a year! http://personal.mail.yahoo.com/
            >
            > ------------------------ Yahoo! Groups Sponsor
            > ---------------------~-~>
            > eGroups is now Yahoo! Groups
            > Click here for more details
            > http://click.egroups.com/1/11231/1/_/_/_/982101923/
            > --------------------------------------------------------------
            > -------_->
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.