GRNOC::WebService::Client - GlobalNOC Web Service Client
Module to implement clients that interact with cosign protected GRNOC CDS web services. Default Method is GET but POST can be used as well. Quick summary of what the module does. Perhaps a little code snippet. use GRNOC::WebService::Client; my $svc = GRNOC::WebService::Client->new( url => "https://sherpa.grnoc.iu.edu/web-service/foobar/example.cgi", uid => "test_uid", passwd => $password, realm => 'Authentication Required', # needed for HTTP basic auth usePost => 0, debug => 0 ); #--- get list of available methods my $res= $svc->help(); if(!defined $res){ print Dumper($svc->get_error()); } else{ print Dumper($res); } #-- get help for specific method my $res= $svc->help(method_name => 'echo'); if(!defined $res){ print Dumper($svc->get_error()); } else{ print Dumper($res); } #--- call a web service method my $res= $svc->echo(data => 'This is a test'); if(!defined $res){ print Dumper($svc->get_error()); } else{ print Dumper($res); } ...
The list of methods available is dependent upon the web service you have bound to. Use get_methods() to retrieve the list of available methods. Only the methods implemented in the client library are listed here.
constructor that takes four named parameters: .
the url that directly indentifies a servcie
the GlobalNOC service identifier, with this client will consult the service naming service to resolve, best URL to use.
the location of the service cache file to use on disk (if not specified does direct nameservice queries)
array containing the locations of nameservices to use
user id for authentication
user password
timeout value in seconds for the connection, if no activity observed in this time period LWP will abort.
boolean value for whether or not we are using http POST style or not
boolean value for whether or not to try and use keep_alives
boolean value for wether or not to use a GRNOC::WebService::Client::Paginator object to iterate through results
string to use as the User-Agent string in request headers, defaults to $0
If set to 1 then ssl certs are validated. Set to 0 when working with untrusted or self-signed certs. Defaults to 1.
hash of http error codes to retry the request on if the request fails
gets the last error encountered or undef.
Returns the Content-Type header of the last issue request
Returns all the headers as an array of objects from the last request
Returns the number of retries
Returns the retry interval in seconds
Sets the number of retries if the initial request fails
Returns the realm set
Sets the retry interval in seconds
Disables or enables returning the raw output instead of attempting to decode JSON. This method should be passed 1 to enable raw output and 0 to disable raw output. Raw output is disabled by default--is can also be set by passing the raw_output parameter in the constructor.
Changes the timeout value in the underlying LWP object. Can only be set by passing timeout in the constructor call.
Updates the cookie jar associated with the underlying LWP object. This can be passed a string representing a file on disk or an HTTP::Cookies object.
Method to ask the underlying LWP UserAgent to save any cookies it might have.
interface to change URL of an existing client, useful in stateful mod_perl. Note: This wipes out any existing URLs that may have been loaded from a service identifier
Wipes out all knowledge the client has about URLs, useful if trying to use one client persistently for multiple requests such as the proxy service
interface to change what service identifier we are using. Note: This wipes out any existing URLs that may have been loaded from a service identifier
interface to change the username, password, and/or realm of the client
interface to change cookies of an existing client, useful in stateful mod_perl. Object given must be a HTTP::Cookies object
GRNOC Systems Engineering, C<< <syseng at grnoc.iu.edu> >>
Please report any bugs or feature requests to C<< <syseng at grnoc.iu.edu> >>
You can find documentation for this module with the perldoc command. perldoc GRNOC::WebService::Client
To install GRNOC::WebService::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GRNOC::WebService::Client
CPAN shell
perl -MCPAN -e shell install GRNOC::WebService::Client
For more information on module installation, please visit the detailed CPAN module installation guide.