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

1125Q. on HTTP::Daemon... timeout problem...

Expand Messages
  • colin_edwards
    Dec 20, 2001
    • 0 Attachment
      I've been having some trouble getting the HTTP::Daemon working... I
      would appreciate any advice you guys can give. The general problem I
      have is that it always seems to timeout, and never actually return
      back an answer. Anyway, below is the source code and output.

      I turned on the on_action function in daemon to see if it was
      actually getting something (it seems to be), but the results are the
      same on the client without that in.





      # --------------------------------
      # SERVER
      # --------------------------------

      use SOAP::Transport::HTTP;

      my $daemon = SOAP::Transport::HTTP::Daemon
      -> new (LocalPort => 1080, Reuse => 1,)
      -> on_action(sub { print $_[2], "\n"; })
      -> dispatch_to('TEST')
      ;

      print "Contact SOAP server at ", $daemon->url, "\n";
      $daemon->handle;

      package TEST;

      sub timecheck {
      return scalar(localtime());
      }


      # --------------------------------
      # CLIENT
      # --------------------------------

      use SOAP::Lite +autodispatch =>
      uri => "http://localhost/TEST",
      proxy => "http://localhost:1080/",
      on_fault => sub {
      my($soap, $res) = @_;
      warn "WARNING: ", ref $res ? $res->faultstring.",
      ".$res->faultdetail : $soap->transport->status, "\n";
      };

      eval {
      print "-->|", TEST->timecheck(), "|<--\n";
      }; &HandleError($@) if $@;

      exit;


      sub HandleError {
      warn "WARNING: @_ \n";
      exit 1;
      }


      # -----------------------------------------------
      # OUTPUT

      Client Output: (server running)
      WARNING: 408 User-agent timeout
      -->|1|<--

      (with server not running)
      WARNING: 500 Could not connect to localhost:1080
      -->|1|<--


      Server Output:
      Contact SOAP server at http://localhost:1080/
      timecheck
    • Show all 3 messages in this topic