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

820Re: [soaplite] question on sending a simple message versus waiting for a result

Expand Messages
  • Duncan Cameron
    Sep 13, 2001
    • 0 Attachment
      Joe

      Bearing in mind that http is a send/receive protocol and that the client probably wants to know that a message did reach the server then this can be handled on the server in a slightly crude way. Override the handle() method in SOAP::Transport::HTTP::Daemon so that a response (200 OK) is sent back immediately, e.g. in your soapd.pl include the following:

      package SOAP::Transport::HTTP::Daemon;

      sub handle {
      my $self = shift->new;
      while (my $c = $self->accept) {
      while (my $r = $c->get_request) {
      $self->request($r);
      $c->send_response(HTTP::Response->new(200));
      $self->SUPER::handle;
      }
      $c->close;
      undef $c;
      }
      }

      package main;

      Your client needs to then test for that particular return code

      $s->echo(SOAP::Data->name(text => $value));
      die 'dying ...', $s->transport->status
      unless $s->transport->status =~ m/200 OK/i;
      print "it seems to have worked!\n";

      If you really want to handle this on the client, then you can look at overriding the send_receive() method in SOAP::Transport:HTTP::Client so that it only sends. If you're really not worried about responses or even errors then you might want to use the tcp transport instead of http.

      I imagine Paul will have a cleaner way of handling this.

      Duncan Cameron

      On 12/09/2001 J Landman <landman@...> wrote:
      >I am using SOAP::Lite for a project, and it is wonderful. Of course, I
      >ran into something that I hoped would not be hard to solve. What I want
      >to do is quite simple to state. I want to (within SOAP::Lite) send an
      >object to a method, and simply have the call return right away without
      >waiting for the method to return a result. That is, the method has
      >desireable side effects, and no real return information.
      >
      >Currently I have to look at either polling a queue that the method places
      >an entry into, or forking a process. I want something more like "fire and
      >forget", or basic messaging. Can this be done easily within SOAP::Lite?
      >Suppose we had a method named return_immediately rather than result, so
      >that our calls might look like
      >
      > SOAP::Lite
      >->uri(/.../)->dispatch_to(/.../)->method(@args)->return_immediately
      >
      > Clues/hints welcome. Thanks!
      >
      >
      >
      >
      > --
      > Joe Landman,
      > landman@...
    • Show all 7 messages in this topic