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

My first POP3 (polling) Server

Expand Messages
  • Steeve Gilbert
    Hi! I ve been able to send my mail SOAP request. Now i have some questions about the POP3 server polling. I m here because i can t find tutorial or exemples
    Message 1 of 2 , Jun 14 2:41 PM
    • 0 Attachment
      Hi!

      I've been able to send my mail SOAP request. Now i have some
      questions about the POP3 server polling. I'm here because i can't
      find tutorial or exemples about this.

      Some Info:
      I have a class "Service" (in the file Service.pm at the same place as
      the server script) that have a method called "Add(numb1, numb2)" that
      return the sum of numb1 and numb2 (is that wonderful! :-)). Here's
      my code...

      use Service; <--- Do i need this?? I've just guess it
      use SOAP::Transport::POP3;

      my $server = SOAP::Transport::POP3::Server
      -> new('user:pass@...')

      **I really don't know what to write in the space where "Service" is.
      And what's the qw()? Being a Perl newbie doesn't help me i guess. :-)

      -> objects_by_reference(qw(Service))

      **I've place the path where "Service.pm" is. Then i've
      place "Service::Add" at both place cause i really didn't know what to
      write there. That's probably ain't it but i can't figure it out. My
      best bet would be that "Module::Name" is the NamespaceURI
      and "Module::method" = "Service::Add".

      ->
      dispatch_to 'C:/MyDeployedModules', 'Module::Name', 'Module::method');

      **So i guess i have to put a dispatch_to line for each method i want
      to expose as a service.

      while (0==0) {
      print "Checking POP3 account...\n";
      print $server->handle;
      print " mail(s) processed.\n";
      print "Waiting 5 sec...\n\n";
      sleep 5;
      }

      I've tried my server several times and the message (SOAP request) is
      always leaved in the mailbox. I post the request before starting the
      server. When i start de server, it says that 1 mail was processed
      then after that, no mail is processed. I guess because there's no
      new mail in the mailbox. But if i send a mail (identical) while the
      server is working it never see the new mail.

      Thanks!
      bye!

      Steeve...
    • Paul Kulchenko
      Hi, Steeve! ... it depends. You have at least two options to give an access to your module. 1. static. use Service; use SOAP::Transport::POP3; my $server =
      Message 2 of 2 , Jun 15 9:02 AM
      • 0 Attachment
        Hi, Steeve!

        > use Service; <--- Do i need this?? I've just guess it
        it depends. You have at least two options to give an access to your
        module.

        1. static.

        use Service;
        use SOAP::Transport::POP3;

        my $server = SOAP::Transport::POP3::Server
        -> new('user:pass@...')
        -> dispatch_to('Service')
        ;

        $server->handle while sleep 10;

        you load module yourself and specify module name in dispatch_to()
        call

        2. Dynamic.

        use SOAP::Transport::POP3;

        my $server = SOAP::Transport::POP3::Server
        -> new('user:pass@...')
        -> dispatch_to('/path/to/service/module')
        ;

        $server->handle while sleep 10;

        you do NOT load your module yourself and specify path to module,
        SOAP::Lite server will load it for you on demand. You can decide
        what's better for you. If you have a bunch of different module and
        don't want to load them all at once, you can follow dynamic model. If
        you have only one module, do it statically.

        > then after that, no mail is processed. I guess because there's no
        > new mail in the mailbox. But if i send a mail (identical) while
        > the server is working it never see the new mail.
        Every time mailbox is scanned from the very beginning, so it should
        pick up new mails.

        you may also switch debug on server side with:

        use SOAP::Lite +trace;

        You will need to modify handle() method in POP3.pm (current version
        sends message to XML parser instead of MIME parser):

        change:
        $self->SUPER::handle($self->get($msgid));
        to
        $self->SUPER::handle(join '', @{$self->get($msgid)});

        Coming version will have it right and provide additional information
        on server side processing.

        Best wishes, Paul.

        --- Steeve Gilbert <sgilbert@...> wrote:
        > Hi!
        >
        > I've been able to send my mail SOAP request. Now i have some
        > questions about the POP3 server polling. I'm here because i can't
        > find tutorial or exemples about this.
        >
        > Some Info:
        > I have a class "Service" (in the file Service.pm at the same place
        > as
        > the server script) that have a method called "Add(numb1, numb2)"
        > that
        > return the sum of numb1 and numb2 (is that wonderful! :-)). Here's
        >
        > my code...
        >
        > use Service; <--- Do i need this?? I've just guess it
        > use SOAP::Transport::POP3;
        >
        > my $server = SOAP::Transport::POP3::Server
        > -> new('user:pass@...')
        >
        > **I really don't know what to write in the space where "Service"
        > is.
        > And what's the qw()? Being a Perl newbie doesn't help me i guess.
        > :-)
        >
        > -> objects_by_reference(qw(Service))
        >
        > **I've place the path where "Service.pm" is. Then i've
        > place "Service::Add" at both place cause i really didn't know what
        > to
        > write there. That's probably ain't it but i can't figure it out.
        > My
        > best bet would be that "Module::Name" is the NamespaceURI
        > and "Module::method" = "Service::Add".
        >
        > ->
        > dispatch_to 'C:/MyDeployedModules', 'Module::Name',
        > 'Module::method');
        >
        > **So i guess i have to put a dispatch_to line for each method i
        > want
        > to expose as a service.
        >
        > while (0==0) {
        > print "Checking POP3 account...\n";
        > print $server->handle;
        > print " mail(s) processed.\n";
        > print "Waiting 5 sec...\n\n";
        > sleep 5;
        > }
        >
        > I've tried my server several times and the message (SOAP request)
        > is
        > always leaved in the mailbox. I post the request before starting
        > the
        > server. When i start de server, it says that 1 mail was processed
        > then after that, no mail is processed. I guess because there's no
        > new mail in the mailbox. But if i send a mail (identical) while
        > the
        > server is working it never see the new mail.
        >
        > Thanks!
        > bye!
        >
        > Steeve...
        >
        >
        > 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!?
        Spot the hottest trends in music, movies, and more.
        http://buzz.yahoo.com/
      Your message has been successfully submitted and would be delivered to recipients shortly.