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

5763Re: [soaplite] Sending return value to soap client without returning from sub { ... }

Expand Messages
  • Mike South
    Dec 25, 2006
    • 0 Attachment
      Hi,

      I don't have a lot of experience doing this kind of thing, but here's
      what I would try first (untested code):


      my $par = shift;

      my $child_pid = fork();
      if ($child_pid) {
      # this is the parent, we'll just return
      return;
      }
      else {
      # this is the child, we'll do the hard stuff and then bail
      doTimeConsumingStuff($par);
      exit;
      }


      On 12/23/06, h_emre_k <kwah@...> wrote:
      >
      >
      >
      >
      >
      >
      > Hi,
      >
      > I wrote a small daemon that receives some index value via SOAP and
      > does further time consuming things based on the value.
      >
      > The SOAP client is supposed not to care if the further actions are
      > sucessfull and it should not wait for the time consuming part to finish.
      >
      > Is there any way to send a SOAP result to the client while still
      > "staying" in the context of the subroutine/method?
      >
      > Right now I have something like this:
      >
      > client.pl
      > ---------
      > my $soap = SOAP::Lite
      > -> on_fault(sub{})
      > -> uri($uri)
      > -> proxy($proxy);
      >
      > my $index = "123";
      > my $result = $soap->doSomething($index);
      >
      > server.pl
      > ---------
      > my $daemon = SOAP::Transport::HTTP::Daemon
      > -> new (LocalAddr => $host, LocalPort => $port, Reuse => 1)
      > -> dispatch_to('FOO');
      >
      > $daemon->handle;
      >
      > package FOO;
      >
      > sub doSomething {
      > my $par = shift;
      > doTimeConsumingStuff($par);
      > return;
      > }
      >
      > What would be the appropriate way to send a return value to client and
      > keep processing $par?
      >
      > I did some searching in this group and read some messages regarding
      > asynchronous messaging. It seemed an overkill to me implementing some
      > kind of task tracking system as I really do not care about the actual
      > result of doSomething();. Most examples also seem to be using the SOAP
      > daemon within an Apache context, which is not what I am using.
      >
      > I´m kind of lost so any hint will be greatly appreciated :)
      >
      > Thanks,
      >
      > Emre
    • Show all 3 messages in this topic