|new (URI [, ARGS])||
Creates a new client object that will route its requests to the URL provided.
The constructor creates a <B>HTTP::RequestB> object and a <B>LWP::UserAgentB>
object, which are stored on the client object. When requests are made, these
objects are ready to go, with the headers set appropriately. The return value
of this method is a reference to the new object. The URI argument may be a
string or an object from the <B>URIB> class from CPAN.
Any additional arguments are treated as key-value pairs. Most are attached to the object itself without change. The following are recognized by new and treated specially:
See the section on the effects of callbacks on return values, below.
|uri ([URI])||Returns the <B>URIB> that the invoking object is set to communicate with for requests. If a string or URI class object is passed as an argument, then the URI is set to the new value. In either case, the pre-existing value is returned.|
|useragent||Returns the <B>LWP::UserAgentB> object instance stored on the client object. It is not possible to assign a new such object, though direct access to it should allow for any header modifications or other needed operations.|
|request||Returns the <B>HTTP::RequestB> object. As with the above, it is not allowed to assign a new object, but access to this value should allow for any needed operations.|
|simple_request (ARGS)||This is a somewhat friendlier wrapper around the next routine (send_request) that returns Perl-level data rather than an object reference. The arguments may be the same as one would pass to the <B>RPC::XML::requestB> constructor, or there may be a single request object as an argument. The return value will be a native Perl value. If the return value is undef, an error has occurred and simple_request has placed the error message in the global variable $RPC::XML::ERROR.|
Sends a request to the server and attempts to parse the returned data. The
argument may be an object of the <B>RPC::XML::requestB> class, or it may be the
arguments to the constructor for the request class. The return value will be
either an error string or a data-type object. If the error encountered was a
run-time error within the RPC request itself, then the call will return a
RPC::XML::fault value rather than an error string.
If the return value from send_request is not a reference, then it can only mean an error on the client-side (a local problem with the arguments and/or syntax, or a transport problem). All data-type classes now support a method called is_fault that may be easily used to determine if the successful return value is actually a RPC::XML::fault without the need to use UNIVERSAL::ISA.
|combined_handler ([CODEREF])||These accessor methods get (and possibly set, if CODEREF is passed) the specified callback/handler. The return value is always the current handler, even when setting a new one (allowing for later restoration, if desired).|
|credentials (REALM, USERNAME, PASSWORD)||This sets the username and password for a given authentication realm at the location associated with the current request URL. Needed if the RPC location is protected by Basic Authentication. Note that changing the target URL of the client object to a different (protected) location would require calling this with new credentials for the new realm (even if the value of $realm is identical at both locations).|
|timeout ([INTEGER])||Get or set the current time-out value on the underlying <B>LWP::UserAgentB> object that this object uses for sending requests. This is just a proxy through to the method of the same name in the <B>LWP::UserAgentB> class. The return value is the current time-out value (prior to change, if a new value is given).|
|message_temp_dir||These methods may be used to retrieve or alter the values of the given keys as defined earlier for the new method.|
The <B>RPC::XML::ServerB> class supports compression of requests and responses via the <B>Compress::ZlibB> module available from CPAN. Accordingly, this class also supports compression. The methods used for communicating compression support should be compatible with the server and client classes from the <B>XMLRPC::LiteB> class that is a part of the <B>SOAP::LiteB> package (also available from CPAN).
Compression support is enabled (or not) behind the scenes; if the Perl installation has <B>Compress::ZlibB>, then <B>RPC::XML::ClientB> can deal with compressed responses. However, since outgoing messages are sent before a client generally has the chance to see if a server supports compression, these are not compressed by default.
compress_requests(BOOL) If a client is communicating with a server that is known to support compressed messages, this method can be used to tell the client object to compress any outgoing messages that are longer than the threshhold setting in bytes. compress_thresh([MIN_LIMIT]) With no arguments, returns the current compression threshhold; messages smaller than this number of bytes will not be compressed, regardless of the above method setting. If a number is passed, this is set to the new lower-limit. The default value is 4096 (4k).
If a callback is installed for errors or faults, it will be called before either of send_request or simple_request return. If the callback calls <B>dieB> or otherwise interrupts execution, then there is no need to worry about the effect on return values. Otherwise, the return value of the callback becomes the return value of the original method (send_request or simple_request). Thus, all callbacks are expected, if they return at all, to return exactly one value. It is recommended that any callback return values conform to the expected return values. That is, an error callback would return a string, a fault callback would return the fault object.
All methods return some type of reference on success, or an error string on failure. Non-reference return values should always be interpreted as errors, except in the case of simple_request.
This began as a reference implementation in which clarity of process and readability of the code took precedence over general efficiency. It is now being maintained as production code, but may still have parts that could be written more efficiently.
Please report any bugs or feature requests to bug-rpc-xml at rt.cpan.org, or through the web interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RPC-XML>. I will be notified, and then youll automatically be notified of progress on your bug as I make changes.
o RT: CPANs request tracker
o AnnoCPAN: Annotated CPAN documentation o CPAN Ratings o Search CPAN o MetaCPAN
o Source code on GitHub
This file and the code within are copyright (c) 2011 by Randy J. Ray.
Copying and distribution are permitted under the terms of the Artistic License 2.0 (<http://www.opensource.org/licenses/artistic-license-2.0.php>) or the GNU LGPL 2.1 (<http://www.opensource.org/licenses/lgpl-2.1.php>).
The <B>XML-RPCB> standard is Copyright (c) 1998-2001, UserLand Software, Inc. See <http://www.xmlrpc.com> for more information about the XML-RPC specification.
Randy J. Ray <firstname.lastname@example.org>
|perl v5.20.3||RPC::XML::CLIENT (3)||2014-02-05|