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

Re: [soaplite] Timeouts when using service descriptions

Expand Messages
  • Mark Knoop
    Here was my solution - both the wsdl fetch, and the method needed timeouts. pat my $soap = SOAP::Lite - proxy( http:// , timeout = 1)
    Message 1 of 3 , Aug 14, 2008
    View Source
    • 0 Attachment

       
      Here was my solution -
      both the wsdl fetch, and the method needed timeouts.
      pat
       
       
       
       
        my $soap = SOAP::Lite
              ->proxy('http://', timeout => 1)
              ->service('http://telnitest00.homer.att.com/wsdl/THING.wsdl')
          ;
       
          return (1, $errors{3} . "can not fetch wsdl", '') unless ($soap);
       
        ...........
       
          $result = $soap  ->proxy('http://', timeout => 2)
          ->fMETHOD_FROM_WSDL($data, $profileId, 1, 1, $partnerId, $userId, $transactionId, "");
       
       
       
      Thanks - I will try this.  For some reason the examples using SOAP::Lite->service('...are disappearing as fast as I can find them... has it been deprecated? Am I losing the plot?
       
       
      ----- Original Message -----
      Sent: Thursday, August 14, 2008 5:00 AM
      Subject: [soaplite] Timeouts when using service descriptions

      Hi

      I am making SOAP requests in the following way (have had to remove real urls
      so not runnable as is but hopefully it makes enough sense):

      ######

      package MyService;

      use strict;
      use warnings;
      use Log::Log4perl qw(get_logger) ;
      use SOAP::Lite;

      our $service = undef;
      our $wsdl = 'https://soap. server.net/ MyServiceDescrip tion?wsdl';

      my $MAX_RETRIES = 5;

      sub service {

      my $log = get_logger(' MyService' );

      unless (defined $service) {

      $log->debug ("Getting WSDL : $wsdl");

      my $retries = 0;

      WSDL: while ($retries < $MAX_RETRIES) {

      eval {
      $log->debug ("Trying $wsdl");
      $service = SOAP::Lite-> service($ wsdl);
      $log->debug ("Got service handle : $service");
      };

      if ($@) {
      $log->logwarn ($@);
      $retries ++;
      $log->info ("Retrying for the $retries time...");
      next WSDL;
      } else {
      last WSDL;
      }
      }
      }

      return $service;
      }

      1;

      #########

      Then calling like this:

      my $result;

      eval {
      $result = MyService::service- >serviceMethod( @params );
      };

      die if $@;

      ###########

      This means I only have to have one service handle and that it will retry a
      few times before it bombs out.

      However I have a (very intermittent) situation where method calls hang
      indefinitely.

      Is the default to wait indefinitely when calling the method like this? If so
      is it possible to set a timeout and how?

      I have had a look at the docs but can only find examples with
      SOAP::Lite-> proxy ... - should I use this instead of SOAP::Lite-> service? Is
      there anything else I could be doing better?

      Any pointers much appreciated.

      Regards
      Mark

    Your message has been successfully submitted and would be delivered to recipients shortly.