GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PROTOCOL::XMLRPC::CLIENT (3)

.ds Aq ’

NAME

Protocol::XMLRPC::Client - Simple XML-RPC client

CONTENTS

SYNOPSIS



    my $xmlrpc = Protocol::XMLRPC::Client->new(
        http_req_cb => sub {

            ...

            $cb->(..);
        }
    );

    $xmlrpc->call(
        http://example.com/xmlrpc => plus => [1, 2] => sub {
            my ($self, $method_response) = @_;

            print $method_response->param->value, "\n";
        },
        sub {
            print "internal error\n";
        }
    );



DESCRIPTION

Protocol::XMLRPC::Client is a simple XML-RPC client. You provide callback subroutine for posting method requests. LWP, AnyEvent::HTTP etc can be used for this purpose.

ATTRIBUTES

CWhttp_req_cb



    my $xmlrpc = Protocol::XMLRPC::Client->new(
        http_req_cb => sub {
            my ($self, $url, $method, $headers, $body, $cb) = @_;

            ...

            $cb->($self, $status, $headers, $body);



A callback for sending request to the xmlrpc server. Don’t forget that User-Agent and Host headers are required by XML-RPC specification. Default values are provided, but you are advised to change them.

Request callback is called with:
o <B>selfB> Protocol::XMLRPC::Client instance
o url server url (for example ’http://example.com/xmlrpc’)
o <B>methodB> request method
o <B>headersB> request headers hash reference
o <B>bodyB> request body to send. Holds Protocol::XMLRPC::MethodCall string representation.
o <B>cbB> callback that must be called after response was received
o <B>error_cbB> callback that is called on error (optional)
Response callback must be called with:
o <B>selfB> Protocol::XMLRPC::Client instance
o <B>statusB> response status (200, 404 etc)
o <B>headersB> response headers hash reference
o <B>bodyB> response body

METHODS

CWnew



    my $xmlrpc = Protocol::XMLRPC::Client->new(http_req_cb => sub { ... });



Creates Protocol::XMLRPC instance. Argument <B>http_req_cbB> is required.

CWcall



    $xmlrpc->call(
        http://example.com/xmlrpc => plus => [1, 2] => sub {
            my ($self, $method_response) = @_;

            ...
        }
    );



Creates Protocol::XMLRPC::MethodCall object with provided parameters and calls http_req_cb with url and body. Upon response parses and created Protocol::XMLRPC::MethodResponse object and calls provided callback.

Parameter are optional. But must be provided as an array reference. Parameters types are guessed (more about that in Protocol::XMLRPC::ValueFactory).

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PROTOCOL::XMLRPC::CLIENT (3) 2011-06-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.