SYNOPSIS

 use Frontier::Client;

 $server = Frontier::Client->new( I<OPTIONS> );

 $result = $server->call($method, @args);

 $boolean = $server->boolean($value);
 $date_time = $server->date_time($value);
 $base64 = $server->base64($value);

 $value = $boolean->value;
 $value = $date_time->value;
 $value = $base64->value;

DESCRIPTION

Frontier::Client is an XML-RPC client over \s-1HTTP\s0. Frontier::Client instances are used to make calls to XML-RPC servers and as shortcuts for creating XML-RPC special data types.

METHODS

new( \s-1OPTIONS\s0 )

Returns a new instance of Frontier::Client and associates it with an XML-RPC server at a \s-1URL\s0. \s-1OPTIONS\s0 may be a list of key, value pairs or a hash containing the following parameters:

url

The \s-1URL\s0 of the server. This parameter is required. For example: $server = Frontier::Client->new( 'url' => 'http://betty.userland.com/RPC2' );

proxy

A \s-1URL\s0 of a proxy to forward XML-RPC calls through.

encoding

The \s-1XML\s0 encoding to be specified in the \s-1XML\s0 declaration of outgoing \s-1RPC\s0 requests. Incoming results may have a different encoding specified; XML::Parser will convert incoming data to \s-1UTF-8\s0. The default outgoing encoding is none, which uses \s-1XML\s0 1.0's default of \s-1UTF-8\s0. For example: $server = Frontier::Client->new( 'url' => 'http://betty.userland.com/RPC2', 'encoding' => 'ISO-8859-1' );

use_objects

If set to a non-zero value will convert incoming <i4>, <float>, and <string> values to objects instead of scalars. See int(), float(), and string() below for more details.

debug

If set to a non-zero value will print the encoded \s-1XML\s0 request and the \s-1XML\s0 response received.

Forward a procedure call to the server, either returning the value returned by the procedure or failing with exception. `$method' is the name of the server method, and `@args' is a list of arguments to pass. Arguments may be Perl hashes, arrays, scalar values, or the XML-RPC special data types below. The methods `\*(C`boolean()\*(C'', `\*(C`date_time()\*(C'', and `\*(C`base64()\*(C'' create and return XML-RPC-specific datatypes that can be passed to `\*(C`call()\*(C''. Results from servers may also contain these datatypes. The corresponding package names (for use with `\*(C`ref()\*(C'', for example) are `\*(C`Frontier::RPC2::Boolean\*(C'', `\*(C`Frontier::RPC2::DateTime::ISO8601\*(C'', and `\*(C`Frontier::RPC2::Base64\*(C''. The value of boolean, date/time, and base64 data can be set or returned using the `\*(C`value()\*(C'' method. For example: # To set a value: $a_boolean->value(1);

# To retrieve a value $base64 = $base64_xml_rpc_data->value(); Note: `\*(C`base64()\*(C'' does not encode or decode base64 data for you, you must use MIME::Base64 or similar module for that.

int( 42 );
float( 3.14159 );

By default, you may pass ordinary Perl values (scalars) to be encoded. \s-1RPC2\s0 automatically converts them to XML-RPC types if they look like an integer, float, or as a string. This assumption causes problems when you want to pass a string that looks like \*(L"0096\*(R", \s-1RPC2\s0 will convert that to an <i4> because it looks like an integer. With these methods, you could now create a string object like this: $part_num = $server->string("0096"); and be confident that it will be passed as an XML-RPC string. You can change and retrieve values from objects using value() as described above.

RELATED TO Frontier::Client…

perl\|(1), Frontier::RPC2\|(3)

<http://www.scripting.com/frontier5/xml/code/rpc.html>

AUTHOR

Ken MacLeod <[email protected]>