GRNOC-WebService-Client

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

1.0.5   06-06-2011
        ISSUE=2311 PROJ=102 dding ability for WS Client to understand service names and grab urls out of name service config file
         dont supply user/pass credentials unless they are given
1.0.4   04-14-2011
        ISSUE=2132 PROJ=102 Switched to JSON::XS 2.x

1.0.2   12-13-2010
        ISSUE=1135 PROJ=102 HTTP Basic Auth support

1.0.1   11-12-2010
        ISSUE=1478 PROJ=102 keep-alive support and fixes when running under mod_perl

1.0.0   06-08-2010
        First production tag of the GRNOC::WebService::Client module
        ISSUE=855 PROJ=102 Supports POST methods
        ISSUE=393 PROJ=102 Configurable Timeouts 

0.03            08-16-09
         splitting out client library from others, finished
         support for new version of Cosgin 

bin/wsutil.pl  view on Meta::CPAN



  -t              timeout in seconds to use for the request.
  --timeout


  -p              use POST instead of GET
  --post          This is a boolean field and does not require an argument.


  -k              enable keepalives
  --keepalive     This is a boolean field and does not require an argument.


  -o              pass raw output from the service instead of trying to 
  --raw           decode it as json This is a boolean field and does not 
                  require an argument. 


  -l              path to cookie file location. If given this will use any 
                  cookies in the file when authenticating to a service and 
                  also save them to this file when done. If not given 

bin/wsutil.pl  view on Meta::CPAN

  # Sort out command line options
  #
  my $url;                
  my $service_name;      
  my $method;           
  my $args;            
  my $username;            
  my $realm;         
  my $timeout;      
  my $usePost;     
  my $use_keep_alive;     
  my $raw_output;        
  my $cookies_location; 
  my $service_cache_file; 
  my $name_services;     
  my $suppress_output;  
  my $help;            
  my $password;
  my $batch;
  my $silent;
  my $delay;

bin/wsutil.pl  view on Meta::CPAN


    'U|url=s'           =>  \$url,
    'S|service=s'       =>  \$service_name,
    'm|method=s'        =>  \$method,
    'a|args=s'          =>  \$args,
    'u|username=s'      =>  \$username,
    'P|password=s'      =>  \$password,
    'r|realm=s'         =>  \$realm,
    't|timeout=i'       =>  \$timeout,
    'p|post'            =>  \$usePost,
    'k|keepalive'       =>  \$use_keep_alive,
    'o|raw'             =>  \$raw_output,
    'l|cookiejar=s'     =>  \$cookies_location,
    'c|servicecache=s'  =>  \$service_cache_file,
    'n|nameservice=s'   =>  \$name_services,
    'X|noresponse'      =>  \$suppress_output,
    'b|batch=i'         =>  \$batch,
    's|silent'          =>  \$silent,
    'd|delay=i'         =>  \$delay,
    'h|help'            =>  \$help,
  

bin/wsutil.pl  view on Meta::CPAN


  #
  # Create our client object using all the things we were passed in.
  my $svc = GRNOC::WebService::Client->new(
             'url'                =>  $url,
             'uid'                =>  $username,
             'passwd'             =>  $password,
             'realm'              =>  $realm,
             'timeout'            =>  $timeout,
             'usePost'            =>  $usePost,
             'use_keep_alive'     =>  $use_keep_alive,
             'raw_output'         =>  $raw_output,
             'cookieJar'          =>  HTTP::Cookies->new(
                                        'file'            => $cookies_location,
                                        'autosave'        => 1,
                                        'ignore_discard'  => 1,
                                      ),
            'service_name'        =>  $service_name,
            'service_cache_file'  =>  $service_cache_file,
            'name_services'       =>  \@name_services_array,
            'timing'              =>  1,

lib/GRNOC/WebService/Client.pm  view on Meta::CPAN

    timeout value in seconds for the connection, if no activity observed in this time period LWP will abort.

=cut

=item usePost

    boolean value for whether or not we are using http POST style or not

=cut

=item use_keep_alive

    boolean value for whether or not to try and use keep_alives

=cut

=item use_pagination

    boolean value for wether or not to use a GRNOC::WebService::Client::Paginator object to iterate through results

=cut

=item user_agent

lib/GRNOC/WebService/Client.pm  view on Meta::CPAN


sub new {

    my $that  = shift;
    my $class =ref($that) || $that;

    my %args = (
        debug          => 0,
        timeout        => 15,
        usePost        => 0,
        use_keep_alive => 1,
        raw_output     => 0,
        timing         => 0,
        user_agent     => $0,
        oldstyle_urls  => 0,
        cookieJar        => undef,
        method_parameter => "method",
        use_pagination   => 0,
        verify_hostname  => 1,
        retry_error_codes => { '408' => 1,
                               '503' => 1,

lib/GRNOC/WebService/Client.pm  view on Meta::CPAN

    {
        # In older versions of LWP::UserAgent::Determined the ssl_opts
        # parameter is not defined, and a warning is logged to the
        # command line. Setting $^W to zero surpresses these warnings
        # within this block.
        local ($^W) = 0;

        $self->{'ua'} = LWP::UserAgent::Determined->new(
            agent      => $self->{'user_agent'},
            ssl_opts   => {verify_hostname => $self->{'verify_hostname'}},
            keep_alive => $self->{'use_keep_alive'}
        );
    }

    #---- check to see if we need to use old style urls. This allows us to use web services that don't parse semicolons the same as ampersands.
    if($self->{'oldstyle_urls'}) {
        CGI->import(qw/ -oldstyle_urls /);
    }

    #---- set the timeout
    $self->{'ua'}->timeout($self->{'timeout'});



( run in 1.904 second using v1.01-cache-2.11-cpan-39bf76dae61 )